Skip to main content
Watch a live training run for reward hacking. 2 public names. import whileai.simulations as wai, then wai.name.

HackMonitor

Watch a TRL run for reward hacking. See the module docstring. holdout is a list of prompts (strings or message lists) or rows ({"prompt": ..., <extra columns>}); extra columns reach the proxy as keyword lists, the way TRL passes dataset columns. proxy is a TRL-shaped reward function (f(prompts=, completions=, **cols)); leave it None to use the reward function passed through wrap. gold is a judge under the SDK contract (a rollout row in, a reward or {"reward": ...} out). sample overrides how completions are drawn: sample(model, tokenizer, prompts, n=, max_new_tokens=) -> list[list[str]]; the default uses the chat template and model.generate; sampling (temperature, top_p, batch) steers that default sampler. n_boot is the bootstrap count behind the gold-vs-window interval, n_perm the permutation count behind the feature scan, scan_min the fewest buffered completions the scan runs on. Every number has its reason in defaults.py (MONITOR_*). run is the platform run the points and alarms land on; None keeps everything on the monitor (history, alarms, summary()).

HackMonitor.evaluate

Sample the holdout from the live policy and score it both ways. Appends to history, logs to the run, checks the alarms. Returns the history entry.

HackMonitor.summary

What the run page and finish carry: the curve points, the alarms, the last scan, where it stopped.

HackMonitor.wrap

The reward function, watched: every completion it scores goes into the buffer with its reward. Pass the result to the trainer as reward_funcs. The name survives, so TRL’s rewards/<name> column does too.

format_hack_monitor

The block a person reads: the curve, then the alarms.