Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

VIPER

VIPER defines and verifies reproducible machine-learning experiments. Before a run, it fixes the dataset, source commit, stage specifications, environment, and reproducibility controls. After the run, it checks the recorded inputs, outputs, measurements, and trained model against that plan.

Install the viper-provenance distribution. Its Python package and command are both named viper.

Directory map

File or directory Role Principal interface
project briefing States the verified deployment position and immediate publication gate Release evidence and next owner action
technical overview Explains VIPER from frozen plan through execution, evidence, verification, and deployment Complete system mechanism and guarantee boundary
v3 protocol Defines the active formal and protocol contract Sections 1–23
application API Defines the typed Python, CLI, and agent-facing operation contract Operations, parameters, results, errors, and discovery
public Python API Defines supported imports, extension points, compatibility, and repository validation Public modules, stage interface, test tiers, and release boundary
development guide Defines the repository environment and validation commands Fast, integration, release, live-CUDA, and domain gates
getting started Shows the installed project, stage, run, retry, benchmark, and GCE path viper init, decorators, Python execution, and CLI execution
implementation contracts Defines each release claim from declaration through acceptance Parameter delivery, HTTP retrieval, metrics, artifacts, attempts, benchmarks, cloud execution, and packaging
publication checklist Tracks implementation and release work Protocol, runner, package, and distribution tasks
versioning policy Separates software releases from serialized document schemas Semantic package versions and document schema_version values
protocol Defines the Pydantic models for the VIPER protocol RunSpec, ResolvedRun, Spec, ResolvedSpec, BenchmarkSpec
verifier Retrieves referenced files and checks cross-record relationships verify_run_result(), verify_benchmark_result()
training resume Captures, serializes, restores, and validates optimizer, generator, and stateful-loader state capture_resume_state(), restore_resume_state()
plan authoring Writes canonical experiment, variant, benchmark, stage, and frozen run-plan files freeze_run_plan(), write_experiment_spec(), write_variant_spec()
stage execution Invokes one canonical stage command and hashes every declared output file execute_stage_process()
current runner Executes and verifies a complete frozen run in the implemented trusted-host environment run()
preflight Checks the committed plan, source repository, environment kind, stage identities, code paths, plan relationships, and metric implementations preflight_local_plan()
local storage Publishes immutable stage snapshots and run files beneath .viper/store LocalArtifactStore
installed command Exposes authoring, preflight, execution, validation, verification, and discovery viper preflight, viper run, viper verify-run
serialization Encodes protocol documents and parses duplicate-key-safe YAML serialize_document(), parse_yaml_bytes(), load_stage_spec(), load_resolved_stage()
examples Supplies a user-project extension tree and loadable protocol records Project code plus download and build records
identifiers Defines run and human-readable identifier types RunId, HumanId
inspection Reads durable attempt state and compares frozen plans, verified runs, and lineage through stable machine-readable paths attempt_status(), plan_diff(), compare_runs(), lineage()
metrics Defines project metric decorators, stateful metrics, comparison, and measurement output metric(), StatefulMetric, MeasurementSink
parameters Defines the public parameter categories that projects specialize Download, Build, Embed, Train, Evaluate, Metric, HttpTransport
worker Executes one project command through an execution backend WorkerRequest, execute_worker()
workspace Creates bounded attempt directories and exclusive run ownership AttemptWorkspace
journal Persists synchronized attempt transitions DurableJournal
package exports Exposes the supported authoring, execution, identifier, protocol, and resume modules Public package imports
supporting documents Contains the active protocol, implementation contracts, publication checklist, and supporting explanations Markdown documents and figures
archive Retains prior model drafts and protocol documents Reference material
v1 protocol
v2 protocol
Retains earlier protocol specifications Reference material

The focused model, verifier, and acceptance checks live in the repository test directory.

Protocol and verification flow

The protocol models divide requested state from realized state. A RunSpec and its ordered stage specs form the frozen run plan. Each completed stage publishes one ResolvedStageRef containing a resolved stage spec and all declared artifact files at one immutable snapshot.

RunSpec + ordered stage specs
              │
              ▼
    permitted runtime-state set
              │
              ▼
RunAttempt.resolved_stages[]
              │
              ▼
ResolvedStageRef.snapshot
├── resolved stage spec
└── exact files for every named artifact
              │
              ▼
          ResolvedRun
              │
              ▼
      verify_run_result()

The verifier starts from ResolvedRun.spec, verifies the exact RunSpec bytes, loads experiment and variant records, retrieves every stage spec, and checks the realized environment, command, inputs, artifacts, measurements, logs, and terminal estimator. Artifact loaders are selected by ArtifactSpec.loader from the exact Git commit recorded by RunSpec.source.

verify_benchmark_result() verifies a second successful attempt, its complete input lineage, estimator and prediction file parity, metric criteria, and result status. verify_promoted_artifact() verifies the selected producer run and any benchmark result required to authorize estimator promotion.

An evaluation measures one candidate. A benchmark standardizes that evaluation across candidates and requires a reproducible, threshold-qualified result. EvaluateSpec binds the candidate parameters, evaluation inputs, metrics, execution parameters, and outputs. BenchmarkSpec repeats the evaluation ID, dataset, splits, and metric IDs, then adds metric thresholds and a fixed execution count. The verifier requires the repeated values to match, which allows one benchmark to govern multiple candidate run plans.

Every stored input and produced artifact declares a data-use role: training, validation, evaluation, or benchmark. The verifier confirms stored-input roles against their producer artifacts, propagates same-run roles, prevents a stage from weakening an inherited restriction, and blocks evaluation or benchmark data from entering a training stage.

Public operations

  • load_stage_spec(path) parses a DownloadSpec, BuildSpec, EmbedSpec, TrainSpec, or EvaluateSpec through the discriminated Spec union.
  • load_resolved_stage(path) parses the corresponding realized record through ResolvedSpec.
  • verify_run_result(resolved_run, policy=..., fetcher=...) verifies one terminal run and returns its connected run plan, successful resolved stages, and measurements.
  • verify_benchmark_result(result, policy=..., fetcher=...) verifies the benchmark record, selected run, confirmation attempt, parity, and metric thresholds.
  • verify_promoted_artifact(pointer, policy=..., fetcher=...) verifies a promoted artifact's producer lineage and benchmark authorization when required.
  • capture_resume_state(...) captures optimizer state, main-process generator state, and the stateful DataLoader state at a training-stage boundary.
  • restore_resume_state(...) restores those values before the next DataLoader iterator is created.
  • save_resume_state(path, resume_state) and load_resume_state(path) write and safely load the reserved resume_state artifact.
  • A custom fetcher receives a GitFileRef or HuggingFaceFileRef and returns bytes. Omitting it uses the package Git and Hugging Face retrieval functions.
  • VerificationPolicy lists the exact source repositories whose artifact loader code may execute. Verification fails before loader retrieval when the run source is absent from that list.
  • freeze_run_plan(repository_root, draft) validates and canonicalizes each stage spec, records its exact hash and byte count, and writes the sibling stage and run spec.yaml files.
  • execute_stage_process(...) verifies the frozen stage-spec bytes, invokes the canonical command, and records every produced artifact file.
  • preflight_plan(repository_root, run_spec_path) checks the complete plan on the active host and returns every applicable named check.
  • run(repository_root, run_spec_path) executes every stage, publishes immutable stage results, writes the terminal resolved.yaml, and verifies the completed run.
  • plan_diff(...) verifies and compares two RunSpecs and every stage spec they identify.
  • lineage(...) verifies one terminal run and returns its directed upstream provenance graph.

Current local execution

Freeze the plan, inspect it, then execute it from the project repository:

viper freeze-run <draft.yaml>
viper preflight <run-spec-path>
viper run <run-spec-path>

RunSpec.source.commit identifies the project source, environment lockfile, metric implementations, and artifact loaders. The Git revision containing the run spec identifies the frozen plan files. VIPER checks both revisions before execution.

The local runner creates an exclusive attempt workspace, applies the run-wide reproducibility controls, invokes each stage through the VIPER runtime bootstrap, materializes declared inputs, publishes immutable results, and runs the complete verifier before returning success.

Python execution interface

Project code declares stage callables with VIPER decorators and executes them through ordinary Python:

import viper


@viper.train_stage(parameter_model=TrainParameters)
def train(context: viper.StageContext[TrainParameters]) -> None:
    ...


if __name__ == "__main__":
    viper.run(train)
python train.py --run <run-spec> --stage train

The installed viper run <run-spec> command will execute a complete plan through the same application coordinator. Local and GCE execution use the same interfaces. The user invokes VIPER inside the selected host; VIPER records and verifies that host's realized environment.

The approved mechanics live in the stage-invocation, process-startup, and cloud-execution contracts.

Validation

Run the fast development gate from the repository root after activating the mantra Conda environment described in the development guide:

make check

The command runs Ruff, formatting, Pyright, and the unit and contract tests. The integration gate exercises process, runner, CLI, resume, and durable-attempt boundaries. The release gate adds the complete generated-project acceptance case:

make check-integration
make check-release

Pytest still honors direct file selection. For example, python -m pytest tests/test_runner_acceptance.py -q runs that complete module.

Current boundaries

  • LocalEnvironmentSpec and GCEEnvironmentSpec use the same in-place runner. GCE execution records the immutable provisioning image, machine type, CPU, CUDA backend, lockfile, and Python environment.
  • Every internal stage binds its versioned JSON parameters to an exact project-owned Pydantic class. VIPER validates the class and values during plan freezing, preflight, and execution.
  • Evaluation reserves the logical artifact name predictions. The project selects its file or bundle format and declares the exact loader path.
  • Data-use roles are assigned by the project when source artifacts enter the provenance graph. VIPER verifies their propagation and permitted stage flows. The project assigns the scientific role when the artifact enters the graph.
  • Each experiment metric records its role, parameters, and exact repository-relative implementation path.
  • VIPER accepts any user source-tree layout. Stage scripts, metric implementations, and artifact loaders are selected by exact repository-relative paths and fixed by RunSpec.source.
  • Artifact loaders execute Python from the Git commit named by RunSpec.source. Verification therefore accepts only run sources trusted to execute in the verifier process.
  • The runner publishes successful, failed, cancelled, and preempted attempts, preserves completed-stage evidence, and retries the same frozen plan through viper.run(stage_callable), viper run, or viper retry.

Download files

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

Source Distribution

viper_provenance-0.1.0a1.tar.gz (241.3 kB view details)

Uploaded Source

Built Distribution

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

viper_provenance-0.1.0a1-py3-none-any.whl (136.1 kB view details)

Uploaded Python 3

File details

Details for the file viper_provenance-0.1.0a1.tar.gz.

File metadata

  • Download URL: viper_provenance-0.1.0a1.tar.gz
  • Upload date:
  • Size: 241.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for viper_provenance-0.1.0a1.tar.gz
Algorithm Hash digest
SHA256 df180baa7a8cf17b5efc69d049904ded479f7081b05a95a955d40948db7c44e3
MD5 14d59418d7741195cf005e84f28a8899
BLAKE2b-256 3632c10d253c113bf9c55fd8143f8626e688cbb7f12667d17c3baa3d05ae6df7

See more details on using hashes here.

Provenance

The following attestation bundles were made for viper_provenance-0.1.0a1.tar.gz:

Publisher: release.yml on pvd232/BioStats

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

File details

Details for the file viper_provenance-0.1.0a1-py3-none-any.whl.

File metadata

File hashes

Hashes for viper_provenance-0.1.0a1-py3-none-any.whl
Algorithm Hash digest
SHA256 7edbc6d36bf2d8226ddeab153411bfb531fbf79dd8d13979cc6fa2c188523fec
MD5 97c98be28064213ef190743c9e331908
BLAKE2b-256 9598febde947084b53cbfd634b78416693e317840359162eae2e95b8a74679aa

See more details on using hashes here.

Provenance

The following attestation bundles were made for viper_provenance-0.1.0a1-py3-none-any.whl:

Publisher: release.yml on pvd232/BioStats

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

Release history Release notifications | RSS feed

This release

0.1.0a1 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page