# Elo Drift Audit

Audit Bradley-Terry win-rate confidence interval bounds, active pair sampling bias, and Elo deflation/inflation drift across benchmark dataset versions.

## Workflow

1. Ingest model score observations across two benchmark releases ($T_1$ and $T_2$):
   - Model identifier
   - Elo rating at $T_1$ and $T_2$
   - 95% Confidence Interval half-widths ($\pm \text{CI}$)
   - Total battle count ($N$)
2. Compute Elo delta:
   $$\Delta \text{Elo} = \text{Elo}_{T_2} - \text{Elo}_{T_1}$$
3. Evaluate statistical significance:
   - Check if $\Delta \text{Elo}$ exceeds the combined 95% CI error margin:
     $$\text{CI}_{\text{combined}} = \sqrt{\text{CI}_1^2 + \text{CI}_2^2}$$
   - Flag drift claims that are merely sampling noise ($|\Delta \text{Elo}| \le \text{CI}_{\text{combined}}$).
4. Detect deflation/inflation: Calculate the average rating movement across all benchmark anchor models.

## Synthetic Input Format

JSON object with:
- `schemaVersion`: 1
- `benchmark`: string
- `anchorModels`: list of objects, each containing:
  - `model`: string
  - `eloT1`: decimal or integer
  - `eloT2`: decimal or integer
  - `ciHalfWidthT1`: decimal
  - `ciHalfWidthT2`: decimal
  - `battles`: positive integer
- `assertions`:
  - `maxAverageAnchorDrift`: optional decimal string (e.g. "15.0")

## Exit Codes

- `0`: Valid observations and drift analysis completed within bounds.
- `1`: Assertion failed (e.g. anchor drift exceeded threshold).
- `2`: Malformed input or safety violation.

## Verification

```sh
python3 scripts/check.py examples/synthetic.json
```
