chnoggin's picture
Add benchmark filesystem 1.3.0 with validated definitions and diagrams
b7e7b31 verified
|
Raw History Blame Contribute Delete
11.1 kB

Data contract, archive schema version 1

Toolkit 1.3.0 retains the legacy archive/record version for compatibility and adds version-1 registered benchmark artifacts. See ARTIFACTS.md and BENCHMARK_WORKFLOW.md for the strict benchmark contract. Runs without benchmark_contract remain legacy/general-purpose runs.

Raw files are immutable through the application and authoritative. The normalized records are an analysis representation. They do not replace the source data or define the scientific meaning of the producer's metrics.

One normalized record

One record represents a model result for one question, variant, filter, and repeat within a run. A paired input line produces two records.

Field Meaning
schema_version Integer 1.
run_id Run folder identifier.
question_id Persistent identity of the underlying question; shared by its variants.
variant_id E.g. original, rephrased, or a distinct rephrasing identifier.
benchmark Benchmark/task name, supplied by the record or run metadata.
script (optional in legacy records) Script identifier; separate scripts never share an item identity. Required for strict benchmark records.
language Language identifier or null. No language is guessed from a path.
model Evaluated model; must match run metadata.
rephrasing_model Model that generated the variant, when known.
filter Harness processing/filter pipeline; defaults to none.
repeat_id Distinguishes deliberate repeated measurements; defaults to 0.
identity_scope stable or run-local. Run-local identities are not paired.
input Available question, prompt, choices, document, and/or model request arguments.
target Supplied answer/reference. Paired choice keys use {"index": 0}.
prediction Supplied prediction. Paired choice results use index/index_norm/index_pmi.
correct Boolean true/false, or null when correctness is unavailable/ambiguous.
scores Existing likelihoods and score arrays; no measurements are invented.
metrics Other producer metrics retained without redefining their meaning.
response Generated text or original harness raw/filtered responses.
source Archived raw file path and one-based source line number.
warnings Interpretation/provenance caveats associated with this record.

Within a run, the unique key is (benchmark, language, question_id, variant_id, filter, repeat_id). Names and ordered answer choices are significant. A comparison joins the same key without variant_id, explicitly selecting the two variants/runs. A rephrasing can reorder choices; correctness must use its own key.

Stable IDs

Automatic lookup checks original_question_id, doc.original_question_id, question_id, doc.question_id, id, and doc.id, in that order. The producer must ensure those IDs identify the same underlying question across versions. --id-field some.dotted.path overrides the lookup. Selecting doc_id still marks an identity as run-local because harness enumeration is not a persistent identity.

Without a stable ID, a source/line-derived identity prevents accidental record collisions, but the record is excluded from pair analysis. It still contributes to independent summaries when correctness is available.

Paired adapter

Required shape: top-level identity/benchmark/model context and original plus rephrased objects. Each variant may contain question, choices, correct_index, pred_acc, pred_acc_norm, pred_acc_pmi, logprobs, logprobs_norm, logprobs_pmi, generated_text, and additional metrics. Indices are zero-based nonnegative integers, and arrays must agree with supplied choice counts.

pred_acc names a choice index. Correctness is obtained by comparing it with a known correct_index for that version, never by converting the index to Boolean. Normalized and PMI prediction indices are retained but do not silently replace the raw correctness criterion used by the default summary.

An explicit variant answer key takes precedence. A shared top-level key can be used for the original, and for a rephrase with identical explicit choices. Where choice order is unavailable, run metadata shared_answer_key: true explicitly asserts that sharing the key is valid; the assertion is recorded as a warning. Explicitly different choice ordering still requires a per-variant key.

Harness adapter

Accepts doc, resps and/or filtered_resps, target, and optional arguments, filter, metric names/values, and hashes. The saved logger format can have arguments as a gen_args_N object and likelihood pair values as strings; those supported numeric likelihood values are converted to numbers in scores, while original responses remain preserved.

The harness's metrics may be a list of names whose values are at the top level or a dictionary. By default, a binary acc or exact_match populates correct. Set run metadata correctness_metric to choose another explicit binary metric, for example acc_norm. A nonbinary value is not coerced into correctness.

Likelihoods remain in request order. Task-specific PMI requests and filtering can change request meaning, so the adapter does not infer a multiple-choice winner from the largest observed likelihood. Original request arguments and responses remain available for task-aware analysis.

Canonical adapter

Use --format canonical for producers that write this contract directly. question_id and variant_id are required (unless explicitly selected through CLI options), and benchmark/model/run context must be present or supplied by the destination run. Run/model conflicts are rejected. The importer supplies its own archived source location; records imported into another run must first have their old run_id removed or intentionally updated by the producer.

Validation and missing values

Inputs must be UTF-8 JSON Lines with one object per nonblank line. A UTF-8 BOM on the first line and CRLF line endings are accepted and preserved in raw files. Duplicate JSON keys, non-finite numbers, invalid field types, duplicate record identities, and inconsistent supplied choice counts are rejected. Failed batch imports publish no partial data.

Null means unknown, not zero. Metrics with different scientific definitions must not be compared solely because their names match. Store producer version and metric definitions in run metadata or attachments.

Manifests contain file paths, original and normalized SHA-256 hashes, record counts, source basenames, timestamps, metadata, attachment hashes/sizes, and open/sealed status. Validation checks registered bytes, record schema, source line references, duplicate identities, counts, and untracked files in managed run directories. Each import also records format, variant override, ID selection, and normalizer version. Validation does not reconstruct all derived records by rerunning the adapter or verify the scientific correctness of a model score.

Item-level comparison reports

compare RUN --items REPORT.html adds an item-level report to the ordinary comparison summary. .html, .csv, and .jsonl select the format; an explicit --format html|csv|jsonl with --items overrides suffix inference. --baseline, --variant, and --other-run select the same records for the summary and report. Known conflicting dataset revisions in a cross-run comparison are rejected.

One report item represents the union of stable identities on the two selected sides. Its identity is (benchmark, language, script, question_id, filter, repeat_id). Matched items contain both records; unmatched items retain the available side. Run-local identities are excluded, with counts for each side in the summary. Duplicate stable identities are an error, not an arbitrary choice of one record.

Outcome categories distinguish both correct, both wrong, correct to wrong, wrong to correct, unscored pairs, and items present on only one side. Unknown correctness does not become an incorrect answer. Aggregate accuracy and its delta use only matched pairs with known correctness on both sides.

  • HTML contains the comparison summary and each side's input, prediction, response, target, correctness, scores, warnings, and source location. Its search and outcome/language filters work offline; it requires no server.
  • CSV contains one row per report item, with side-by-side fields. Nested values are JSON-encoded, null is blank, and formula-like strings are escaped for spreadsheet use. Use JSONL when distinctions between null and blank matter.
  • JSONL retains the full normalized record for each available side, including additional producer fields. These nested records retain their archived source references; the raw JSONL remains the authoritative source.

Scores are displayed with their existing names and structure. The report does not derive arbitrary log-probability differences or infer semantic answer agreement from equal prediction indices. Correctness is read from each record, which must have been scored against its own version's target. Comparable IDs do not prove that a rephrasing preserved meaning or that metric definitions match.

Reports are derived local files. Writing is atomic and refuses to overwrite an existing destination. Report generation does not change or reseal runs, and the Hub uploader does not automatically upload derived reports.

Recovery and restoration

The application holds a local writer lock. A manifest replacement commits an import. If a process stops partway through, its transaction journal lets the next write keep committed files and remove files that were never committed. An operating-system lock is released automatically when the writer exits.

After downloading a Hub repository, run python3 -m babel_fs --root DOWNLOADED_FOLDER init to recreate empty local operational directories that remote repositories cannot preserve. Then run validate. Missing registered data remains an error; initialization does not fabricate or recover lost results.

Registered benchmark extensions

The five artifact registries are item-banks/, protocols/, model-panels/, calibrations/, and releases/. Each immutable ID stores manifest.json and artifact.json; references pin the payload SHA-256. validate checks all registered artifacts and their dependencies as well as runs. hub-plan includes all registered artifacts and adds calibration input runs even when a narrower run selection was requested. hub-pull restores and validates that dependency set from one pinned commit.

For strict runs, identity also includes the explicit script; comparisons require the same bank and protocol references. Different checkpoints are intentionally comparable. A response matrix preserves shared global IDs across languages while keeping their separate observations and all family/split/grouping identifiers. It does not pool correctness across languages or estimate any IRT parameters.