ExamplesΒΆ
Short, self-contained scripts that demonstrate the library. Every page
here is a literalinclude of a runnable .py file from the
examples/
directory of the repository - the code you see is the code that runs.
Example |
What it shows |
Runs on |
|---|---|---|
Train a DoM probe on a small HF model and use it as a monitor. |
CPU or GPU, downloads SmolLM-135M |
|
Score |
CPU, no model |
|
Fuse detectors with |
CPU, no model |
|
Flag preference pairs where the chosen completion is more hack-like than the rejected. |
CPU, no model |
|
Build a TRL-compatible reward function from a |
CPU, no model |
Only the first example needs a real model (SmolLM-135M, ~270 MB). The
rest use a CallableDetector stand-in so they run instantly without
model weights. In production you swap the stand-in for
HackMonitor.from_pretrained("your/probe") or
HackMonitor.from_probe(probe, model=..., tokenizer=...).