Contributing to zkml-audit-benchmark
Thank you for your interest in extending this benchmark. This guide walks you through the workflow for adding a new (paper, codebase) pair and authoring bug artifacts that target it.
If you are filing a bug report, label correction, or documentation fix instead, please open an issue first; the workflow below is specifically for content contributions to the dataset.
Quick Reference
| Task | Where |
|---|---|
| Add a new (paper, codebase) pair | Sections 1 and 2 |
| Author bug artifacts | Section 3 |
| Regenerate derived files | Section 4 |
| Validate before submitting | Section 5 |
| PR checklist | Section 6 |
Authoritative schema: schema/artifact.v2.schema.json.
Recently changed/added items: CHANGELOG.md.
1. Add the codebase snapshot
For a new pair pair_id (use a short, lowercase identifier — e.g., zkfoo):
- Freeze the codebase. If the upstream project uses Git, prefer pinning to a commit hash:
If the upstream project ships a non-Git release (e.g., a Zenodo tarball), record the source URL and the snapshot date in yourgit clone <upstream-url> /tmp/upstream cd /tmp/upstream && git checkout <commit-sha> git archive --format=zip --prefix=zkfoo/ HEAD -o /path/to/zkml-audit-benchmark/codebases/zkfoo.zipCHANGELOG.mdentry. - Verify the LICENSE file is included inside the ZIP. Each codebase retains its upstream license; we redistribute for research-reproducibility purposes only.
- Add the paper PDF at
papers/{pair_id}.pdf. Use the publisher's canonical PDF where possible; record the source URL inCHANGELOG.md. - Track the ZIP via Git LFS (the repository is configured for
*.zipLFS; new pair ZIPs are picked up automatically).
2. Register the pair in build_parquet.py
Open scripts/build_parquet.py and add your pair_id to the PAIR_IDS list at the top of the file:
PAIR_IDS = ["zkgpt", "zkllm", "zkml", "zktorch", "zkfoo"]
The script auto-discovers artifacts under artifacts/{pair_id}/*.json and pulls codebase / paper hashes from codebases/{pair_id}.zip and papers/{pair_id}.pdf. Static pair metadata (paper title, venue, year, language, snapshot note) lives in data/pairs.parquet; if you are adding a brand-new pair, you will also need to add a row to that table — the simplest path is to load it via pyarrow, append a row, and write it back. See scripts/build_parquet.py for the exact schema.
3. Author bug artifact JSONs
Each artifact is a single JSON file at artifacts/{pair_id}/{Pair}-NNN.json. Use the camel-case pair prefix that matches the existing artifacts (zkLLM, zkML, zkTorch, zkGPT, or your new zkFoo) and a zero-padded three-digit sequence.
3.1 Required fields (per artifact.v2.schema.json)
| Field | Purpose |
|---|---|
artifact_id |
Unique ID matching ^(zkML|zkTorch|zkLLM|zkGPT|<your prefix>)-\d{3}$ |
codebase |
Target codebase directory name (matches the directory inside the ZIP) |
source |
"real" (from a real audit report) or "synthetic" (authored for coverage) |
finding.name |
Human-readable short title, 3–7 words |
finding.explanation |
One paragraph: root cause and impact |
finding.labels.relevant_code |
Comma-separated file:line[-line] references (or empty string) |
finding.labels.paper_reference |
Section/theorem/protocol citation, optionally with a quoted claim (or "-") |
edits |
Ordered list of code edits using ops: replace_block, insert_after, insert_before, delete_block, replace_regex, create_file |
conflict_keys.files |
All files touched by the edits |
conflict_keys.regions |
Expanded line-range regions for overlap detection |
conflict_keys.semantic_tags |
Semantic labels; two artifacts sharing a tag are treated as conflicting |
conflict_keys.requires |
(Optional) artifact IDs that must be applied first |
conflict_keys.incompatible |
(Optional) artifact IDs explicitly incompatible with this one |
presence_probes |
Post-injection assertions; the dataset_generator uses these to validate that the bug actually landed |
A minimal skeleton:
{
"artifact_id": "zkFoo-001",
"codebase": "zkfoo-fixed",
"source": "synthetic",
"finding": {
"name": "Missing range check on softmax witness",
"explanation": "The softmax output is loaded as a free advice cell without a polynomial constraint binding it to the input. A malicious prover can substitute any value and still satisfy the circuit.",
"labels": {
"relevant_code": "src/softmax.rs:42-58, src/circuit.rs:120",
"paper_reference": "Section 4.2: \"Each non-linear operator is enforced via a lookup argument against the precomputed table.\""
}
},
"edits": [
{
"file": "src/softmax.rs",
"op": "delete_block",
"anchor": { "kind": "line_range", "start": 42, "end": 58 }
}
],
"conflict_keys": {
"files": ["src/softmax.rs"],
"regions": [{ "file": "src/softmax.rs", "start": 42, "end": 58 }],
"semantic_tags": ["softmax-range-check"]
},
"presence_probes": [
{
"kind": "line_equals",
"file": "src/softmax.rs",
"line": 42,
"expected": " fn forward(&self, ..."
}
]
}
3.2 Authoring guidance
- Make each artifact atomic: one soundness gap per artifact. If a single conceptual bug requires two related edits in different files, keep them in one artifact and use multiple
editsentries. - Tie every artifact back to a paper claim in
paper_reference. If no specific paper section maps cleanly, use"-"and explain the reasoning infinding.explanation. The grader's paper-reference scorer is part of the quality gate, so accurate citations materially improve scoring. - Use precise line ranges in
relevant_code. The grader scores code-location matches by line proximity (overlap, within 2 lines, within 30, within 100); imprecise references reduce match quality even when the agent finds the right bug. - Write
presence_probesthat fail loudly if the edit silently no-ops.line_equalsprobes that pin the exact post-injection content of the modified line are the most reliable. - Set
semantic_tagsto enable safe composition: two artifacts that share a tag are treated as conflicting byRandomStrategyindataset_generator. Use tags for what the bug is about (e.g.,softmax-range-check,pedersen-commit-aux), not for general areas of the code. source: "real"vs."synthetic": userealonly when the artifact is grounded in an external audit report or in a documented soundness gap from the original paper's released code. Synthetic artifacts are authored for coverage and should clearly describe the construction.
4. Regenerate Parquet and MANIFEST.json
After adding/modifying artifacts, papers, or codebases:
cd zkml-audit-benchmark/
python scripts/build_parquet.py
This rebuilds:
data/artifacts.parquet(one row per artifact, with flattened metadata)data/pairs.parquet(refreshesartifact_countfor each pair)MANIFEST.json(SHA-256 hashes for every file in the dataset)
Commit the regenerated files alongside your content changes — they are part of the dataset and consumers rely on them.
5. Validate
5.1 Byte-exact integrity
python scripts/verify_dataset.py
This re-hashes every file listed in MANIFEST.json and verifies the result matches. Any mismatch indicates a stale Parquet/MANIFEST regeneration.
5.2 JSON-schema conformance
Each artifact must conform to schema/artifact.v2.schema.json. A minimal validation snippet:
import json
from pathlib import Path
from jsonschema import Draft202012Validator
schema = json.loads(Path("schema/artifact.v2.schema.json").read_text())
validator = Draft202012Validator(schema)
for af in Path("artifacts").rglob("*.json"):
instance = json.loads(af.read_text())
errors = list(validator.iter_errors(instance))
assert not errors, f"{af}: {errors}"
5.3 Presence-probe round-trip (recommended)
For real validation that an artifact lands cleanly on the clean codebase, generate a single-artifact case via the companion zkML-inspector-benchmark tooling:
python -m dataset_generator test \
--output /tmp/probe_check \
--num-cases 1 \
--artifacts-per-case 1 \
--strategy fixed \
--artifact-ids zkFoo-001
A successful build with no errors in /tmp/probe_check/errors.json confirms that the artifact's edits and probes are consistent.
5.4 Croissant metadata
The NeurIPS Datasets & Benchmarks Track requires Hugging Face–hosted datasets to ship valid Croissant metadata. Hugging Face auto-generates the Croissant file from your dataset card and Parquet configs after every push. Validate it after pushing your changes via:
https://huggingface.co/spaces/JoaquinVanschoren/croissant-checker
If the checker reports errors, they typically trace back to YAML frontmatter in README.md or to a malformed Parquet schema; fix and re-push.
6. PR Checklist
Please confirm each of the following before opening a pull request:
- New pair (if any) registered in
scripts/build_parquet.py(PAIR_IDS). - Codebase ZIP and paper PDF placed under
codebases/andpapers/respectively, with upstream LICENSE preserved inside the ZIP. - Each new artifact JSON conforms to
schema/artifact.v2.schema.json(validated as in §5.2). -
python scripts/build_parquet.pyre-run; resultingdata/*.parquetandMANIFEST.jsoncommitted. -
python scripts/verify_dataset.pypasses with no errors. -
paper_referencecites a specific section/theorem/protocol from the bundled PDF (or is"-"with rationale infinding.explanation). -
CHANGELOG.mdupdated with a new entry (artifact IDs added, label changes, codebase fixes, schema changes). - If submitting during a NeurIPS review window: no personal identifiers in PR description, commit messages, or new files.
Schema Evolution
Backward-incompatible changes to the artifact JSON format ship as a new schema file (schema/artifact.vN.schema.json) rather than mutating the existing one. Each artifact records its target schema version implicitly via its on-disk shape; existing artifacts are migrated in a single, separately-committed pass with a CHANGELOG.md entry.
If you have a proposal that requires a schema bump, please open an issue first to discuss the migration plan before submitting a PR.