rhscope.envs.base¶
Abstract hacking-environment interface + registry.
A BaseEnv combines (a) a task distribution, (b) a gameable reward
function used to drive RL training, and (c) a ground-truth hacking signature
for labeling rollouts after the fact.
The reward function is the signal the policy optimizes against. The hacking signature is the oracle used for probe training data and benchmark labeling. Together they let a researcher:
Run RL training that will plausibly induce hacking (reward is weak / gameable by design).
After each rollout, label whether the policy actually gamed the reward via
hacking_signature.Use those labels as supervision for probe training or as eval metrics.
Concrete subclasses self-register via BaseEnv.__init_subclass__();
BaseEnv.registered_envs() lists them for discovery and
BaseEnv.get_env_class(name) looks one up by name.
- class rhscope.envs.base.EnvTask(task_id, prompt, metadata=<factory>)[source]¶
Bases:
objectA single task from an environment.
- Variables:
task_id (str) – Stable identifier for this task across train/eval splits.
prompt (str) – What the policy sees as input. Typically the full instruction text including any boilerplate the environment expects.
metadata (dict[str, Any]) – Env-specific information needed by
reward_fnandhacking_signature(reference solutions, test specs, …). Opaque to the framework; validated by the env that produced it.
- Parameters:
- class rhscope.envs.base.BaseEnv[source]¶
Bases:
ABCAbstract interface for a reward-hacking training environment.
Subclasses implement
train_tasks,eval_tasks,reward_fn, andhacking_signature. Theevaluate_hacking_ratehelper is a default implementation that iterateshacking_signatureover policy outputs.Subclasses are auto-registered against their
nameclass attribute at class-creation time. Useregistered_envs()to discover them andget_env_class()to look one up.- Variables:
name (ClassVar[str]) – Short machine-friendly identifier used in recipes and logs.
- abstractmethod reward_fn(task, response)[source]¶
Compute the training reward for
responseontask.This is the signal the policy optimizes against. For hacking envs the reward is intentionally gameable (weak tests, lax verifier, …).
- abstractmethod hacking_signature(task, response)[source]¶
Oracle labeling: did the policy game the reward on this task?