circularity-reveal
Reveal circular systems in LLM-judge evaluation from a pair of nugget-bank leaderboards.
An LLM judge is circular when its nugget bank shares its source with one of the systems it grades. Such a system scores higher under that nugget bank than its quality warrants. This package takes the per-topic scores of every system under a tested nugget bank and under a reference nugget bank, runs two independent tests, and plots the outcome.
The Two Tests
Swap test. Does the reference nugget bank confirm the wins a system obtains under the tested nugget bank? A win is counted whenever a system beats another by more than the critical difference of the tested leaderboard. A system is revealed when the reference certifies the opposite ordering, or when the number of its unconfirmed wins passes a threshold, by default 20 percent of all systems. The swap test makes no assumption about how the two score scales relate. It therefore needs a diverse pool of comparison systems.
Value test. Is the tested score of a system higher than its reference score predicts? A robust affine fit by Theil-Sen regression on the system means predicts the tested score of each system from its reference score. A system is revealed when its mean residual above that fit exceeds a critical difference. This critical difference is calibrated on residuals around Theil-Sen lines fit within each topic, so that the margin reflects topic-to-topic scatter instead of the lack of fit of the single slope. The value test assumes that the two nugget banks are affinely related. It detects inflation at any rank, including the top rank.
Both critical differences are obtained with the randomized Tukey HSD permutation
test and are computed on the same shared topics, which align() enforces.
Install
Install from PyPI
pip install circularity-reveal # core (numpy)
pip install "circularity-reveal[plot]" # with the result plot (matplotlib)
pip install "circularity-reveal[autojudge]" # with the CLI's auto-judge eval-file reader
To depend on it from another package, add it to the pyproject.toml of that
package:
[project]
dependencies = [
"circularity-reveal>=1.0.0",
# or with extras: "circularity-reveal[plot,autojudge]>=1.0.0",
]
Install from Source
There are two ways to install from source. Use one of them.
Option 1: Clone the repository and install it with pip.
git clone https://github.com/TREMA-UNH/circularity-reveal.git
cd circularity-reveal
pip install -e ".[test,plot]"
Option 2: Without a clone, add this entry to the pyproject.toml of your own
package. Installing your package then fetches the source from GitHub.
[project]
dependencies = [
"circularity-reveal @ git+https://github.com/TREMA-UNH/circularity-reveal.git",
]
License
MIT, see LICENSE.
Use as a Library
Scores are passed in memory as {system: {topic: score}}, one dictionary per
nugget bank. reveal() aligns the two dictionaries and runs both tests in one
call:
from circularity_reveal import reveal
result = reveal(tested_scores, reference_scores) # aligns and runs both tests
result.revealed # frozenset of systems revealed by either test
result.swap.revealed # swap test alone; d_tested, d_reference, counts
result.value.revealed # value test alone; slope, intercept, d_residual
Each step is also available on its own and operates on an aligned pair of
ScoreMatrix objects:
from circularity_reveal import align, swap_test, value_test, plot_reveal
tested, reference = align(tested_scores, reference_scores)
swap = swap_test(tested, reference)
value = value_test(tested, reference)
plot_reveal(tested, reference, swap, value,
planted=known_circular_systems,
xlabel="tested bank", ylabel="reference bank")
SwapResult holds the two critical differences and, for each system, the
number of unconfirmed and contradicted wins. ValueResult holds the fit, the
residual critical difference, and the residual of each system.
Command Line
With the [autojudge] extra, the CLI reads auto-judge ir_measures eval files
directly. --measure selects one measure key, given without its nugget bank
name:
circularity-reveal \
--tested ours/judge/both.eval.txt \
--reference pool/judge/both.eval.txt \
--measure AVG_GRADE__rubric \
--plot reveal.png --json reveal.json
The CLI prints the systems revealed by each test and the critical differences.
The options --alpha, --theta, --perm, and --seed adjust the tests, and
--format selects a different eval file format.
Tests
pip install -e .[test,plot]
pytest
Metadata
Release files for circularity-reveal 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| circularity_reveal-1.0.0.tar.gz | 102.7 kB | Without provenance | Details for circularity_reveal-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| circularity_reveal-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for circularity_reveal-1.0.0-py3-none-any.whl |
Total release size: 116.1 kB
Release files / circularity_reveal-1.0.0.tar.gz
| Download URL | circularity_reveal-1.0.0.tar.gz |
|---|---|
| Size | 102.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
980435067dfe0af80589977b869727da2ad48846116d677377cc895175d42f28
|
|
BLAKE2b-256 checksum How to use checksums |
737599c5ea3fb0c16c84c93d64dfd841faa068802abb8d6619f2885f24d74aa2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.13
|
Release files / circularity_reveal-1.0.0-py3-none-any.whl
| Download URL | circularity_reveal-1.0.0-py3-none-any.whl |
|---|---|
| Size | 13.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7669404e5aa53a6b59109463e7e692bd886e564c5f4fbb92756ed8a82dd45316
|
|
BLAKE2b-256 checksum How to use checksums |
7b4eebc992e685c0709b3ee76206b32c3a31afe59692ce56e0721cb9b9261f27
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.13
|
Security for circularity-reveal 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.