rhscope.probes.dom

Difference-of-means (DoM) probe.

Given pooled activations labeled as hack vs clean, the DoM probe stores a single direction:

direction = (mean_hack - mean_clean) / ||mean_hack - mean_clean||

Score of a new activation x is the signed projection direction · x. Higher = more hack-like.

Optionally, the probe can store a whitened direction computed from the pooled within-class covariance (ZCA-style). This often improves separability when class covariances are similar but highly anisotropic.

References

Arxiv 2609.19101 - “Monitoring and Discovering Reward Hacking with Internal Representations”. The core difference-of-means construction is from this paper.

class rhscope.probes.dom.DoMProbe(metadata, *, whiten=False)[source]

Bases: Probe

Difference-of-means probe over pooled activations.

Variables:
  • probe_type (ClassVar[str]) – Discriminator used by the Probe registry.

  • whiten – If True, compute the direction from whitened activations. This information is stored in metadata.extra so load can round-trip it faithfully.

Parameters:
probe_type: ClassVar[str] = 'dom'
property direction: Tensor

Unit-norm direction vector (hidden_dim,).

property whiten: bool

True iff the probe uses the ZCA-whitened direction variant.

fit(hack_activations, clean_activations)[source]

Fit by taking the normalized difference of class means.

Parameters:
  • hack_activations (Tensor) – Shape (N_hack, hidden_dim).

  • clean_activations (Tensor) – Shape (N_clean, hidden_dim).

Raises:

ValueError – If either tensor is empty, has the wrong rank, or has hidden dimension different from the probe’s metadata.

Return type:

None

score(activations)[source]

Project activations onto the probe’s direction.

Parameters:

activations (Tensor) – (N, hidden_dim) or (hidden_dim,).

Returns:

(N,) or scalar tensor. Higher = more hack-like.

Return type:

Tensor

state_dict()[source]

Return the learned direction and bias tensors.

Return type:

dict[str, Tensor]