The comparison report answers three questions that a mean and p-value leave open: which questions changed, which questions did not enter the comparison, and whether one passage accounts for much of the apparent gain. It is a local, self-contained HTML file. All evidence and fonts are embedded; it can be opened without a server or internet connection.
This feature is in the unreleased source checkout, not the published 0.2.4 package.
From the repository root:
uv sync --locked --no-dev
uv run --no-dev errorbars compare tests/fixtures/lm_eval_output \
--model-a hf-internal-testing/tiny-random-gpt2 --model-b sshleifer/tiny-gpt2 \
--html comparison.htmlOpen comparison.html. There is also a ready-to-open
COPA comparison artifact.
Download that HTML file and open it locally.
The source CLI protects every loaded input path and any results sidecar used
for model identity. --html refuses a destination that aliases one of them,
as well as symbolic-link destinations. CSV import and SVG export use the same
complete-write replacement: an I/O failure preserves an earlier output.
On POSIX, successful new and replaced outputs have mode 0600.
For direct Python use, write_csv protects its recorded source paths;
write_comparison_html(..., protected=paths) accepts original paths explicitly
because a comparison review retains only display basenames. Input paths passed
to these APIs are interpreted in the caller's working directory.
Executable output-integrity study.
For pip users, pip install . installs the checkout; the same errorbars compare
command works without uv run --no-dev. NumPy is the only runtime dependency.
These are two real retained lm-eval 0.4.13 captures, each covering 20 COPA
questions, already committed in tests/fixtures/lm_eval_output/. No new inference
calls were made for this report. The models are tiny test models; these results
are a demonstration of investigation, not a model recommendation.
| Observation | Value |
|---|---|
| A: tiny-random-gpt2 mean | 0.8000 |
| B: tiny-gpt2 mean | 0.6000 |
| Mean A - B | +0.2000 |
| Paired-t 95% interval (diagnostic) | [-0.0881, +0.4881] |
| Paired-t p-value (diagnostic) | 0.1625 |
| Selected exact McNemar p-value | 0.2890625 |
| A higher / B higher / equal | 6 / 2 / 12 |
| Shared IDs with matching content signatures | 20 |
Choose B higher and open copa-15. A scored 0; B scored 1. Both observations
point to record 16, line 16 of their respective source files, with the score key
acc and filter none. copa-16 is the other lower score hidden by the aggregate
gain. Filtering these two cases does not rerun the test. The interval above
still describes all 20 shared questions and still contains zero.
The report and CLI select from the shared observation structure, using the same policy as the leaderboard:
| Shared observations | Selected inference |
|---|---|
| Multiple questions in each of independent clusters | Clustered t (CR2) |
| One binary observation per question, without grouped questions | Exact McNemar |
| Continuous scores or repeated-generation question means | Paired t |
CLI and report JSON add inference with the selected test, p_value and
matching interval. Exact McNemar has null interval endpoints and confidence:
an exact mean-difference interval is not implemented. Its paired-t interval is
retained as a labeled approximation. Existing comparison and CLI top-level
p_value/CI fields retain their paired-t diagnostic meaning for compatibility.
Use inference for the selected conclusion. mcnemar_applicable is false when
binary-looking means actually average repeated generations.
The two-win counterexample and real-outcome audit show why this matters. The earlier screenshot above documents ledger inspection; the current headline uses exact McNemar for these 20 single binary outcomes.
The coverage table separates all questions in each input from the shared cohort. All-question means can change simply because different questions were evaluated; the paired estimate uses only shared IDs. Missing scores are not filled with zero. Questions absent from both inputs cannot be discovered without an external roster.
The ledger retains the union of both question sets. Each side shows the question's mean and its number of observations. Selecting it shows the actual samples or epochs, scores and source locations. Sample labels do not pair individual generations across runs: generations are averaged within each question and model, then questions are weighted equally. Unequal sample counts therefore do not give one question more votes.
An empty intersection, a single shared question or one independent cluster cannot
support the requested inference. With --html, the command writes an inspectable
report and still exits nonzero. It does not emit a successful numeric result
or invent an interval. Without --html, it reports the same inference error.
uv run --no-dev errorbars compare examples/data/reading_comprehension.csv \
--model-a tuned-70b --model-b baseline-70b --html clustered.htmlThis second dataset is synthetic. The mean difference is +0.0700 over 200
questions in 40 passages. The cluster-robust 95% interval is [-0.0199, +0.1599].
Omitting passage-005 leaves a mean difference of +0.051282; that passage is the
largest absolute shift in this fixture. Click its name to inspect its five
questions. They retain their original scores and source locations.
For a cluster C with n_C questions and differences d_i:
Full difference = sum(d_i) / n
Cluster contribution to the full difference = sum(d_i in C) / n
Difference without C = sum(d_i outside C) / (n - n_C)
Shift = difference without C - full difference
The deleted-cluster result is descriptive. No new p-value or confidence interval is fitted to the selected subset. It is not a reason to remove an inconvenient passage and then declare significance. Unequal cluster sizes retain equal weight per question, not per cluster. Singleton-only groups do not need a separate cluster-deletion table; the question ledger already exposes those contributions.
A reused question ID can conceal a changed document or reference answer. Native lm-eval imports compute:
question_hash = "lm-eval-doc-target-v1:" + SHA256(canonical JSON of {doc, target})
Canonical JSON here uses sorted object keys, ASCII escaping, compact separators
and finite JSON values. Object key order is ignored; string content, array order,
numeric serialization and target content are retained. This is an exact content
check, not a semantic-equivalence test or the RFC 8785 canonicalization scheme.
Prompt arguments, model responses and the log's own doc_hash are excluded.
An absent/empty document or absent/null target leaves the signature unavailable.
| Report state | Meaning |
|---|---|
| Matching | Both models provide the same signature for every observed generation of this question |
| Partial | Available signatures agree, but some repeated observations have no signature |
| Unavailable | At least one model has no known signature for this question |
| Conflicting | Known signatures differ; inference is withheld for the entire comparison |
CSV/JSONL can supply question_hash; --question-hash-col maps another column.
errorbars import lm-eval ... and errorbars import inspect ... preserve native
signatures in the canonical CSV.
Blank or absent hashes remain unknown; they never inherit another model's hash.
Different known hashes across generations of a single model/question are refused
before averaging.
Text-only Inspect logs now compute inspect-text-sample-v1: plus the SHA-256 of
canonical JSON containing the original logged input, ordered choices and
target. A scalar target is normalized to a one-element list. Text messages
retain roles, order and text blocks; generated message IDs, source annotations
and message metadata are excluded. A string content block and a one-element
text-block list normalize alike. Retained local text attachments are resolved
before hashing; dangling references leave identity unavailable. No network
resource is fetched.
Inspect stores dataset input separately from the solver's conversation. Solver messages, system-prompt changes applied by a solver, responses and scores do not enter the signature. The controlled Inspect example records both a valid solver variant and a different dataset with reused IDs.
This changes the native import policy for Inspect experiments that rewrite the dataset input itself: these now conflict even if the author intended two prompt wordings for the same underlying question. Exact input equality cannot establish semantic equivalence. Review the mapping outside Errorbars and supply canonical CSV with independently reviewed question IDs/signatures for that experiment. Omitting signatures leaves an explicitly unchecked pairing.
Media, tool histories, sandbox/file/setup-backed samples, empty inputs or targets, and unsupported message fields do not receive a signature. Other metadata, external environments and grader settings are not verified by text signatures.
On a conflict, inspect the two source records, confirm the dataset version, reference answer and ID assignment, then correct the inputs or explicitly choose the intended common cohort outside this report. Renumber genuinely different questions so they cannot masquerade as a pair. There is no silent conflict-dropping or ignore-conflicts switch. Equal hashes do not establish compatible scorers, filters, dataset representativeness or trustworthy user-supplied signatures.
Native Inspect imports additionally require a successful, complete recorded
cohort: planned, completed and recorded sample counts must agree, each question
must have its planned epochs, and the recorded IDs must match sample_ids when
that selection is available. Invalidated or errored samples are refused even if
they have scores. The planned count describes the selected run, so intentional
limits and ID selections remain valid. This does not reconstruct questions
omitted from both selected runs, nor make an early-stopped sample representative.
Question content and scoring rules are separate evidence. Two runs can contain identical answers to identical questions yet receive different grades because the grader changed. The retained Inspect captures demonstrate a false 33.3-point improvement caused by that change alone.
Native Inspect imports retain inspect:<selected scorer> and a versioned SHA-256
fingerprint of the result's recorded parameters. They use the results declaration,
including after re-scoring, rather than assuming the initial task declaration is
current. Raw grader parameters are not exported. Missing result parameters remain
unknown. lm-eval imports retain lm-eval:<metric> with unknown configuration;
filters remain separate provenance because they can define the model-system
variant being compared.
Canonical CSV/JSONL can retain these optional columns:
| Column | Meaning | Missing value |
|---|---|---|
scorer |
Namespaced scoring-rule name | Unchecked rule |
scorer_config |
Fingerprint of the recorded configuration | Unchecked configuration |
scorer_value |
Exact selected key in a dictionary-valued score | Whole scalar score when scorer is known |
--scorer-col, --scorer-config-col and --scorer-value-col map custom column
names. --scorer selects an Inspect scorer; --score-key selects one named
value returned by that scorer. Configuration fingerprints and selected keys
require a scorer name. Blank configuration cells and absent/null configuration
values remain unknown. Keys are exact nonblank strings: punctuation and case
are preserved, without interpreting dots or slashes as a nested path.
errorbars import and write_csv preserve the declarations; removing these
columns removes the check. Earlier CSV exports need re-importing from native
logs to recover the metadata.
For named Inspect values, every selected sample must contain the selected key
with a recognized scalar grade. Missing keys, nulls, nonfinite numbers and
unknown grade strings reject the import instead of changing the denominator or
counting them as zero. Other named values do not enter the selected analysis.
Nested dictionaries, arrays and automatic key selection are not supported.
--score-key applies to Inspect inputs; it fails if no Inspect log was supplied.
Canonical input already carries its selection in scorer_value.
Different selected keys, or a selected key versus a whole scalar score from the
same named scorer, are conflicting scoring declarations. This check survives
CSV export and does not depend on having a configuration fingerprint. It does
not prove that identically named values have the same units or implementation.
The original scorer parameters remain hashed rather than copied into reports.
The selected key is visible in each observation, complete JSON downloads and
the filtered summary CSV's scorer_values_a / scorer_values_b columns. The
summary CSV contains question means, not a canonical observation-level import.
See the retained Inspect example.
Python callers can supply EvalData(..., scoring=[ScoringRule(name, config_hash), ...]) using ScoringRule from errorbars.io. One entry corresponds to one
observation; None means unknown. filter_model and concat preserve it.
review_comparison includes per-question scoring states and cohort counts
n_scoring_matching, n_scoring_conflicting and n_scoring_unavailable.
CLI comparison JSON adds the same counts under scoring_rules. Report observation
records retain the name and fingerprint, and the inspector exposes both.
A different known name or configuration on any shared question withholds the whole paired estimate and ranking. Both scores remain visible; the difference for that question is unavailable. Conflicting declarations within one model/question are refused before averaging repeated generations. Unknown observations cannot erase a known conflict, and cannot count as a matching check.
Matching declarations establish only exact agreement of recorded labels and
parameters. They do not check implementation versions, hidden defaults, grader
model versions, external state, representativeness or trustworthy user-supplied
labels. Aliases and omitted versus explicit defaults are not normalized into
equivalence. Resolve a conflict by re-scoring both runs under one declaration.
Numeric-only paired_compare cannot perform this provenance check.
- JSON retains all questions and observations, source references, content
signatures, comparison statistics, cohort counts, warnings and descriptive
cluster sensitivity. It has
format: errorbars-comparison,schema_version: 1.comparison: nullandunavailable_reasonrepresent withheld inference. - CSV exports all questions matching the current filters, across every page. It includes the model names, mean scores, A - B difference, observation counts, coverage and identity state. Formula-like text cells are prefixed with an apostrophe; JSON preserves the exact original identifiers. Missing values stay blank. Scores are in their original units, not automatically percentages.
- The ledger renders at most 40 questions, 25 observations per selected side, and 12 clusters per page. The complete data stays in the artifact. Native file parsing, statistical calculations, serialization and browser JSON loading still require memory proportional to the full input. Paging is not a file-size or total-work limit.
- Source references are one-based record numbers and inclusive physical line ranges when available. Multiline CSV and skipped JSONL lines retain their locations; CSV ranges may include blank separators. Inspect uses sample record order plus the observed sample ID/epoch. Data constructed directly in Python can lack locations, which the report marks unavailable. After canonical CSV export and reimport, locations refer to that CSV. Generate the report directly from native logs to retain their original source locations.
- The report includes identifiers, score data, sample labels and source basenames. It omits raw prompts, responses and full source paths. Distinct files with the same basename get distinct source numbers. These exported identifiers and filenames can still be sensitive; omission of raw text is not anonymization.
- The artifact performs no network requests. A restrictive Content-Security-Policy admits only its exact embedded script/style hashes and data fonts. Imported labels render as text; control/bidirectional characters display as visible escapes. No theme or data is written to browser storage.
- Printed output shows the currently displayed pages and selected observations, with an explicit print note. Keep the HTML or JSON for the full evidence.
from errorbars.inputs import load_inputs
from errorbars.review import review_comparison
from errorbars.report import write_comparison_html
data = load_inputs(["tests/fixtures/lm_eval_output"]).data
review = review_comparison(data, "hf-internal-testing/tiny-random-gpt2", "sshleifer/tiny-gpt2")
write_comparison_html(review, "comparison.html")
evidence = review.as_dict()review_comparison can return an unavailable comparison with a complete ledger;
check review.inference before using its selected test and interval. Writes replace the destination
atomically so a failed replacement leaves the previous report intact.
See verification for the real browser workflows, independent calculations, wheel installation and measured limits.
