VertexAGI/experiment-rh1-reward-hacking main
Module built on the numeric Python stackImports the NumPy array library
SHA-25649c048a05104321e0db04decddc550084b50ed4e55f7b0c847983535658e0775
MaleculeH₂(Db₂F)
Evidence
1#!/usr/bin/env python3
2"""Experiment RH1: The Spilling Cleaner -- render one full episode of the
3trained policy to show the reward hack directly: the action sequence, and
4a heatmap of how many timesteps the agent spent in each grid cell (a
5genuinely task-completing …
⋯4 lines
10
11import mlx.core as mx
12import numpy as np
13
14from env import SpillingCleanerEnv, ACTIONS
⋯8 lines
23:24… .obs_dim, len(ACTIONS))
24 policy.load_weights(os.path.join(HERE, "policy.safetensors"))
25 mx.eval(policy.parameters())
26
27 visit_counts = np.zeros((env.grid_size, env.grid_size), dtype=int)
28 obs = env.reset()
29 print(f"Initial dirty cells: {int(env.dirty.sum())} / {env …
30:24… ion: {tuple(env.pos)}\n")
31 print(f"{'step':>4} {'pos':>6} {'action':>7} {'reward':>6} {'note'}")
32
33 done = False
⋯4 lines
45:10… # NOTE: was_dirty_here reflects state BEFORE this step's action;
46 # the self-spilled/genuine distinction is tracked precisely
47 …