Skip to main content

gradecore

One deterministic, no-LLM-judge grading engine, used by the crash-test platform (on-demand adversarial testing) and wire-compatible with model-drift (longitudinal monitoring). Zero dependencies.

On that compatibility, precisely: model-drift does not import gradecore, and declares no dependency on it. What is verified is that the two agree, which is the claim worth making and the one that can be checked: both compute the same suite_hash (e76f17b6c56e) over model-drift's suite, and all 35 of its graders lift through bool_grader with 0 of 175 verdicts differing. "Shared by" was the older wording here and it was false in code.

Every grade is a pure predicate over a string, so it reproduces exactly. The property a drift board and a vulnerability score both depend on. No second model grades the first; there is nothing here you can't rerun and get the same answer.

from gradecore import exact, contains, number, GradeInput, suite_hash

exact("blue")(GradeInput(text="  BLUE "))       # -> Verdict(passed=True, score=1.0, severity="none", …)
contains("signal", "process")(GradeInput(text="signal a process"))   # both needles required
number(3.14, tol=0.01)(GradeInput(text="about 3.141"))               # extracts + tolerance-compares
A paired comparison declining to name a winner because only four tasks separate the two variants

Eight tasks, two prompt variants, four disagreements. Four cannot clear p<0.05 even under a clean sweep, so the suite reports that it cannot decide rather than naming a winner: python3 -m demos.underpowered. Play it as a terminal session. The text is selectable.

The one signature

model-drift's graders are Callable[[str], bool]; rag-eval-lab's return floats gated by thresholds. gradecore reconciles both under GradeInput -> Verdict, which generalizes boolean into a severity-scored verdict without losing the boolean case:

Verdict(passed: bool, score: float, severity: str, detail: str, grader_id: str)
#        pass/fail    0.0..1.0       none|low|med|high|critical

What's here (v0.1)

  • Scalar/text graders lifted from model-drift's suite combinators - exact, contains, regex, exact_cs, one_of, number.

  • bool_grader(fn, grader_id): lifts any existing Callable[[str], bool] unchanged, so model-drift's frozen SUITE runs through gradecore without being rewritten. (Verified: gradecore's suite_hash over that SUITE is byte-identical to model-drift's own fingerprint.)

  • suite_hash(identities): the freeze-and-fingerprint discipline, so a silently-edited suite is detectable and two runs are only comparable if they answered the same questions.

  • Retrieval/grounding family (grounding.py). With the empty-gold / empty-answer gotchas corrected.

  • Adversarial graders (adversarial.py). Injection-resistance, tool-misuse, spec/format-violation, refusal-calibration. Shipped with crash-test Phase 1.

  • Trajectory scoring (trajectory.py) and paired comparison stats (paired.py). The sign-test/permutation machinery that refuses underpowered verdicts.

pip install -e ".[dev]" && pytest -q        # 84 tests, zero dependencies

MIT · by Erik Hill

Release files for gradecore 0.10.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gradecore 0.10.2
File Size Uploaded
gradecore-0.10.2.tar.gz 30.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for gradecore 0.10.2
File Interpreter ABI Platform
gradecore-0.10.2-py3-none-any.whl Python 3 none any Details

Total release size: 52.3 kB

Release files / gradecore-0.10.2.tar.gz

Download URL gradecore-0.10.2.tar.gz
Size 30.0 kB
Tags Source
SHA-256 checksum
How to use checksums
9dcb31eb5a027c412fdd2f1d1b7021cb6f3834b6686fc0b5d517b20a7810b386
BLAKE2b-256 checksum
How to use checksums
182ab0c4ecb16f62646c0e97e1b2882a96305004a02aec2f79da5be4957e1621
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Release files / gradecore-0.10.2-py3-none-any.whl

Download URL gradecore-0.10.2-py3-none-any.whl
Size 22.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2c909e813635abc0bdd01d73e37ffe643f198e8819b8500a244713bb1615cec4
BLAKE2b-256 checksum
How to use checksums
cdd1612d4789e511bf12ecab541d139886ab8f621bd4f260a548616f5c3da0eb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Release history Release notifications | RSS feed

This release

0.10.2 This release

2 release files

0.10.1

2 release files

0.10.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page