This repository contains a methodological note and exact finite-population analysis for auditing machine-scored outcomes in experiments.
Researchers may score every experimental outcome with a machine-learning model or large language model while obtaining human labels for only a probability sample. Overall prediction accuracy does not reveal whether scoring errors distort the treatment contrast. This project studies the distribution of treatment-effect estimates induced by which experimental clusters receive gold-standard labels.
For a linear treatment contrast, the average fixed-budget raw-swap path is mechanically determined by the proxy and gold endpoints. Its dispersion and tails reveal whether the correction is diffuse, concentrated in a few clusters, or offsetting across clusters.
For cluster contribution
\widehat\tau_P+\sum_{g\in S_k}\psi_g. $$
Its mean is forced to interpolate between the proxy and gold estimates:
\widehat\tau_P+ \frac{k}{G}(\widehat\tau_G-\widehat\tau_P). $$
The design-scaled estimate
\widehat\tau_P+ \frac{G}{k}\sum_{g\in S_k}\psi_g $$
is a standard Horvitz-Thompson difference correction and a simple prediction-powered estimator. What is new is the object: the exact distribution of this estimator over labeling designs, used to price a validation budget before it is spent.
Three propositions and a remark sharpen the diagnostic. A sharp Cauchy-Schwarz bound,
The generated example contains 20 equal-size experimental clusters and exactly enumerates every fixed-size validation set. Three machine-scoring error patterns share the same gold outcomes, predictive RMSE, and predictive
- Diffuse errors allocate the gold-minus-proxy treatment-effect gap equally across clusters.
- Concentrated errors allocate the same gap to two clusters.
- Offsetting errors have large positive and negative cluster contributions but a zero endpoint gap.
The first two cases have the same proxy effect, gold effect, predictive accuracy, and mean swap path. Their random-swap distributions differ sharply.
replicate_final.py Exact enumeration, tables, and LaTeX macros
validation_swaps.tex Paper source
references.bib Bibliography, validated against Crossref and arXiv
validation_swaps.pdf Compiled paper
generated/ Reproducible CSVs and LaTeX fragments
tests/ Econometric identities and reproducibility checks
pyproject.toml Runtime and development dependencies
Makefile Analysis, checks, paper build, and Docker CI
Python 3.11 or newer is required.
uv sync --extra dev
uv run make analysisThe analysis writes:
table_scenarios.csvandtable_scenarios.textable_budgets.csvandtable_budgets.texmacros.texmetadata.json
The manuscript inputs all tables and repeated numerical results from these generated files.
For a smaller functional run:
uv run make analysis-fastCommand-line overrides are available for the cluster count, cluster size, seed, and output directory:
uv run python replicate_final.py \
--clusters 20 \
--cluster-size 50 \
--seed 2024 \
--outdir generatedExact enumeration accepts at most 22 clusters. Larger designs require a sampling approximation, which this release does not implement.
uv run make check
uv run make papermake check runs Black, isort, Flake8, Ruff, and pytest. make paper regenerates the exact analysis and compiles the manuscript, including the bibliography. The local container target uses the standard Python 3.13 image:
make ci-dockerThe exact swap distribution is available when gold-minus-proxy discrepancies are observed for the finite validation pool, as in a benchmark dataset or a pilot used to study smaller future budgets. With one small validation sample, unseen cluster contributions cannot be recovered nonparametrically. Population inference requires known validation inclusion probabilities or a stated transport model. Swap quantiles are not confidence intervals for the experimental treatment effect.