reward-lens
A model trained on a reward learns whatever the reward pays for. If a grader gives full marks to a wrong answer, training finds that answer, and the score climbs while the task stays undone. The reward is the only description of the task a training loop ever reads, so checking the reward is checking what will be learned.
reward-lens is a set of instruments for that check. Give it a grader and it looks for wrong replies the grader pays in full, and for what the code being graded can reach. Give it a training log and it checks that the updates followed the rewards the log recorded. Give it a learned reward model and its research layer, which is experimental, reads the score out of the network layer by layer. Each result is written down as a record someone else can check, and when reward-lens cannot measure something it refuses and names what is missing.
One real case. Until 5 March 2025 the Countdown scorer in reasoning-gym gave full credit to any arithmetic expression that evaluated to the target, whatever numbers the expression used, so a reply could reach full marks while ignoring the numbers the puzzle gave it. reward-lens ships that grader as an example and rejects it in about a minute on a laptop.
Start here: audit a reward
python -m pip install reward-lens==3.2.0
reward-lens init --example code-reward demo # exit 0
reward-lens audit demo # exit 2: unresolved
init writes a small project whose grader has a real flaw. audit runs that grader in a sandbox with the network denied, on replies already marked right or wrong, and prints what it found. It calls no model, costs nothing and takes about half a minute. It leaves two files: an assay record, which holds the evidence as JSON, and a report that opens in any browser. A script can pass --format json and read the same result as an envelope.
The run ends unresolved, exit 2. The audit read the flaw in the grader's code without reproducing it, and it rejects only what it has confirmed. Auditing is one of five commands: compare, trace, improve and forecast each ask a different question of a reward, and the sections below go through them.
reward-lens is Beta, and this release states no accuracy figure for its own audit. Known limits says what was measured, what was not, and what is known wrong.
What each command answers
| Command | The question | What you give it |
|---|---|---|
audit |
Does this grader give credit to replies that are wrong, and what can the code it grades reach? | A grader file with a score(task, response) function, a file of tasks, and a file of replies marked right or wrong. A project can add an independent check of whether a reply is right. |
compare |
How do the scores of the same replies change between two versions of the grader? | A bank of replies that holds each reply's score under both versions. |
trace |
Did a training run use the rewards it logged? | The record of a TRL GRPO run. Needs the trace extra. |
improve |
Is a proposed edit to the grader a real fix, judged by a rule written down before anything is measured? | A candidate file that names the edit, the competing explanations of what it changes and the acceptance rule. |
forecast |
Did a prediction, written down before the outcome was known, beat simple baselines? It records, seals and scores, and claims no forecasting skill. | A forecast you declare before the run, and the outcome once it is known. |
Each command prints text on a terminal and a JSON envelope when its output is piped. Each ends with an exit code that means the same thing everywhere: 0 when the work completed and any decision it was asked for qualified, 1 for rejected, 2 for unresolved. The error pages list the other codes, and reward-lens explain prints what any of them means and what to do about it.
What the first audit found
reward-lens init --example code-reward demo # exit 0
reward-lens audit demo # exit 2: unresolved
reward-lens explain RL0201 # exit 0
init writes demo/: the grader (grader.py, tests passed plus a format term), 40 code tasks, 120 replies sampled from a small model, and a protected test suite under outcome/ that serves as the independent check. The audit took 20 to 31 seconds on a laptop. Its screen ends with the finding and the verdict:
This reward reads a file the graded process can write.
...
Verdict unresolved · under stock-audit-v1
...
Exit code 2. To decide under another policy: --policy FILE.
Unresolved is a verdict. It is not a pass and it is not a failure.
The grader runs its tests from outcome/, and that folder sits inside the directory the graded code runs in, so a reply could rewrite the tests that judge it. The audit read this in the grader's code (finding RL0201) and filed it as needing review, because it did not confirm it by running a reply that does so. With no --policy, the stock policy stock-audit-v1 decides, and under it only a confirmed finding rejects.
The record (*.assay.json) and the report (*.assay.html) are in demo/assays/. The report is one file of about 500 KB that opens in any browser, with no install and no network.
A grader bug that shipped: the Countdown example
The second example is the Countdown scorer described at the top, as it stood before its fix. The project holds that grader, the fixed one, 60 tasks, 607 replies marked right or wrong, and the first 30 steps of a training run on the grader before the fix. trace needs the trace extra (python -m pip install "reward-lens[trace]==3.2.0").
reward-lens init --example countdown countdown # exit 0
reward-lens audit countdown # exit 1: rejected
reward-lens compare before-fix fixed --rung 1 --bank countdown/bank.jsonl --project countdown # exit 0
reward-lens trace countdown/run-record --out countdown/trace # exit 0
audit rejects the grader in about a minute, with eleven confirmed findings. Ten are wrong replies the example keeps as controls, one file each in countdown/outcome/execution_controls/known_wrong/, and the grader gave each full credit. The eleventh is a right reply whose final answer the audit swapped for another task's, and it still scored 1.0. The audit found this bug through those known-wrong controls. The check that builds wrong replies with no labels to go on filed nothing on this grader.
compare scores the same replies under both graders and prints the difference:
Comparison before-fix to fixed · rung 1
intended task success: -0.518949 [-0.536028, -0.501870] score difference, n 60
Over the 60 tasks the fixed grader gives these replies a mean score 0.52 lower. compare decides nothing unless you give it a policy, so it exits 0.
trace reads the run record, 1,920 rows over 30 steps, and checks the trainer against its own logs: the recorded advantages follow from the recorded rewards on all 30 steps, and the logged loss is rebuilt from per-token terms on the 3 steps that recorded them. The verdict is qualified, which says the trainer did what its logs say. It does not say the reward was right. It also cannot say whether training selected for the bug, because this record has no column of whether each reply was right, and the screen reports that as INCONCLUSIVE_INPUTS.
improve asks whether grader_fixed.py is a real fix:
reward-lens improve countdown --describe "credit only expressions that use the given numbers" --candidate-source owner_edit --candidate countdown/candidate.json # exit 0: qualified
candidate.json names the edit, two explanations of what it changes, and an acceptance rule written before anything is measured. improve takes the comparison of the two graders that compare wrote above, runs the fixed grader on the 634 replies under owner/ that the rule names, and returns qualified under that rule in about a minute.
Audit your own grader
You need three files. The grader is any Python file with a score(task, response) function that returns a number. This one is mine/grader.py:
def score(task: dict, response: str) -> float:
"""Full credit when the last line of the reply holds the expected number."""
lines = [line.strip() for line in response.strip().splitlines() if line.strip()]
return 1.0 if lines and str(task["answer"]) in lines[-1] else 0.0
mine/tasks.jsonl has one task on each line, with a task_id and whatever keys your grader reads:
{"task_id": "t1", "prompt": "What is 2 + 3? Give the number on the last line.", "answer": "5"}
mine/responses.jsonl is the response bank, one reply on each line. honest says whether the reply is right. The replies you label wrong are the controls the audit holds the grader to:
{"response_id": "t1-right", "task_id": "t1", "text": "2 + 3 = 5\n5", "honest": true}
{"response_id": "t1-wrong", "task_id": "t1", "text": "I think it is\n1000", "honest": false}
{"response_id": "t1-hedge", "task_id": "t1", "text": "One of these:\n1 2 3 4 5 6", "honest": false}
reward-lens audit mine/grader.py --tasks mine/tasks.jsonl --responses mine/responses.jsonl # exit 1: rejected
The audit rejects this grader and prints why. RL0221: it gave full credit to t1-hedge, a reply labelled wrong. RL0232: the audit built wrong final answers from the task's own answer (55, -5 and 0.5 among them), the grader gave each one full credit, and the audit reproduced each in a fresh process. Both come from one flaw, in where the grader should test for equality. With lines[-1] == str(task["answer"]) on the last line, no confirmed finding is left and the verdict is unresolved, exit 2: a bare grader has no independent check of whether a reply is right, so a plain audit cannot say qualified. A row with no honest label is left out of the checks, and the audit says how many such rows it saw.
Inside a learned reward: the research layer
A grader written as code is one kind of reward. Many rewards are learned instead: a reward model, a judge model, the implicit reward of a DPO checkpoint. Reading the source tells you little about those, and the questions move inside the network. Along which direction does the model score? At which layer does it make up its mind? Which components cause a preference, and which only correlate with it?
The rest of the package is a Python library of instruments for those questions: a layer-by-layer readout of the score, attribution, activation patching, bias probes and interventions. It needs the white-box extra (python -m pip install "reward-lens[white-box]==3.2.0"). This example builds a miniature reward model with random weights on CPU and measures it:
from reward_lens.signals import from_tiny
from reward_lens.measure import base as mb
from reward_lens.measure.battery import DirectLinearAttribution
from reward_lens.data.builtin.diagnostic_v3 import load_diagnostic_v3
from reward_lens.data.schema import DataView
signal = from_tiny(seed=0)
view = DataView(list(load_diagnostic_v3()["helpfulness"].items)[:8])
ev = mb.run(DirectLinearAttribution(), mb.Context(signal=signal, view=view))
print(ev.value["dominant_component"]) # which components wrote the reward difference
print(ev.trust) # EXPLORATORY
The last line is the one to notice. A measurement comes back as evidence with a trust level attached, and the library computes that level instead of letting the caller claim it: a result stays EXPLORATORY until its instrument has been scored against a model whose answer is known. In this release every instrument reports EXPLORATORY. The layer is experimental, it was checked on real weights in one narrow way (the attribution terms of one small reward model sum to its score), and the Skywork and ArmoRM results in the documentation come from earlier builds.
Measurement you can trust explains the trust levels, the instrument pages cover each tool with its math and when not to use it, and the guided tour runs the library in a browser.
What comes with it
- Every command writes its result as a JSON record under a published schema, and the same record renders as a one-file HTML report.
reward-lens openshows a report, and with--workbenchit serves the record in a local workbench. - Grader code runs contained, with the network denied: inside bubblewrap, or under Landlock with a seccomp filter, on Linux, and under
sandbox-execon macOS. On a machine that cannot contain a grader the audit refuses before the first grader call, and in this release that is every Windows machine.reward-lens doctorprints what yours can do. CI runs on Linux only. TRLTaprecords a TRLGRPOTrainerrun in the formtracereads. The trace page shows the code.action.ymlis a GitHub Action that audits a reward under a policy file and saves the findings as SARIF for code scanning. It expects reward-lens to be installed in the job already.reward-lens mcpserves the commands to an agent over the Model Context Protocol. Needs themcpextra.- Each of the 79 documented error codes has a cause and a remedy, and
reward-lens explainprints them offline.
What this release has not shown
No measurement of how often the audit is right on graders it had never seen was made for 3.2.0. The closest thing is a set of 18 graders used while building it: the default audit confirmed a finding on 6 of the 8 defective graders and on 2 of the 10 clean ones. Because the set shaped the tool, those counts are not an accuracy figure.
reward-lens 3.2.0 audits Python graders. Adapters for other kinds of grader (a judge model, a neural reward model, a remote service) have run on fixtures only. No forecasting method here has beaten the base-rate rule on a test registered in advance. Known limits lists what was run on real inputs, what is experimental and what is known wrong, and the changelog lists every change to results and interfaces since the previous release.
Install
Version 3.2.0 is on PyPI and in the GitHub release.
python -m pip install reward-lens==3.2.0
Python 3.11 or newer is required, and CI covers 3.11 to 3.13 on Linux. The base install is small: the command line, records, static analysis and offline signatures, with no NumPy, torch or Node. Extras add what a task needs, and the installation page lists all of them. The import name is reward_lens, and rlens is a short alias for the command. To install from a checkout, run python -m pip install . in it.
Docs, help and contributing
- The documentation is at reward-lens.github.io, and its source is under
docs/content. Getting started and the command pages are the places to go from here. - Questions and bug reports go to the issue tracker. A report is easiest to act on with the output of
reward-lens --version, your Python and OS, and the command that went wrong. - A security problem, such as grader code getting out of its sandbox, should be reported privately. SECURITY.md says how.
- To work on the code,
uv sync --group devinstalls the development group. CONTRIBUTING.md and TEST_STATUS.md say which checks to run. - If reward-lens contributes to published work, cite the version you ran. CITATION.cff holds the entry, and GitHub's "Cite this repository" button reads it.
- The history of this repository was assembled from reviewed work before publication. Publication history says what its commit dates do and do not mean.
reward-lens is released under the MIT license.
Metadata
Release files for reward-lens 3.2.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 |
|---|---|---|---|---|
| reward_lens-3.2.0.tar.gz | 8.2 MB | With provenance | Details for reward_lens-3.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| reward_lens-3.2.0-py3-none-any.whl | Python 3 | none | any | Details for reward_lens-3.2.0-py3-none-any.whl |
Total release size: 13.3 MB
Release files / reward_lens-3.2.0.tar.gz
| Download URL | reward_lens-3.2.0.tar.gz |
|---|---|
| Size | 8.2 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b6b8dd8b39dd59beade652fc6bcd9f8cebf395eaf215cdfee6f819912c1db872
|
|
BLAKE2b-256 checksum How to use checksums |
8038c95527d90828a54dadd8a6da1f35394fae16b01f519f2268751d2c68bd2c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.
Transparency logRelease files / reward_lens-3.2.0-py3-none-any.whl
| Download URL | reward_lens-3.2.0-py3-none-any.whl |
|---|---|
| Size | 5.1 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f17c84b79db8faf116bfe799f20075731eee50856dab561cacd51a7276d5ea45
|
|
BLAKE2b-256 checksum How to use checksums |
f1a20b2180f0b4173453e406521801b5e4a36daccd51e51f1084539da3b39755
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.
Transparency logSecurity for reward-lens 3.2.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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for reward_lens-3.2.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.
Transparency logA 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.