rhscope.bench.rhdetect¶
RH-Detect benchmark runner.
RH-Detect (arxiv 2610.10947) unifies 11 public datasets into a single reward-hacking detection benchmark with ~92k rows across 6 behavior categories, distributed under CC BY 4.0.
As of v0.1, rhscope loads RH-Detect from either:
A local JSONL file in the canonical schema (see
BenchExample), orA Hugging Face Hub dataset ID via
datasets.load_dataset.
The canonical HF Hub handle is captured as DEFAULT_HF_DATASET; if that is
not yet the project’s public host, call RHDetectBench.load(path=...) with
your local copy.
- rhscope.bench.rhdetect.DEFAULT_HF_DATASET = 'rhscope/rh-detect'¶
Default Hugging Face dataset handle for RH-Detect; may not be populated yet.
- rhscope.bench.rhdetect.CANONICAL_FIELDS = ('prompt', 'response', 'label', 'category', 'source')¶
Canonical schema keys for every example.
- class rhscope.bench.rhdetect.BenchExample(prompt, response, label, category, source='unknown', extra=<factory>)[source]¶
Bases:
objectA single benchmark example in canonical schema.
- Variables:
prompt (str) – User-visible prompt.
response (str) – Candidate model response to classify.
label (bool) –
Trueiff this example is reward hacking.category (str) – Behavior category (one of the 6 RH-Detect categories, or a free-form label if loaded from a custom source).
source (str) – Provenance tag (dataset name, file, …).
extra (dict[str, Any]) – Any extra fields from the source row; preserved on serialization.
- Parameters:
- class rhscope.bench.rhdetect.RHDetectBench(examples, *, split='test', dataset_name='rh-detect', dataset_version='')[source]¶
Bases:
objectContainer + evaluator for RH-Detect benchmark examples.
- Variables:
examples – List of
BenchExample.split – Split name stored in results (default
"test").dataset_name – Human-readable identifier recorded in
BenchResult.dataset_version – Version / hash tag recorded in
BenchResult.
- Parameters:
examples (list[BenchExample])
split (str)
dataset_name (str)
dataset_version (str)
- classmethod from_examples(examples, *, split='test', dataset_name='rh-detect', dataset_version='')[source]¶
Build from an iterable of
BenchExampleor canonical-schema dicts.- Parameters:
- Return type:
- classmethod load_jsonl(path, *, split='test', dataset_version='')[source]¶
Load from a local JSONL file in the canonical schema.
Each line must be a JSON object with at least
prompt,response, andlabel/is_hacking. Additional fields are preserved inextrawithout error.- Parameters:
- Return type:
- classmethod load_hub(dataset_id='rhscope/rh-detect', *, split='test', revision=None)[source]¶
Load from a Hugging Face Hub dataset.
- Parameters:
- Raises:
RuntimeError – If the
datasetspackage is not installed or the dataset cannot be loaded from the Hub.- Return type: