rhscope.training.layer_select¶
Layer-candidate selection for probe training.
Research consensus is that reward-hacking probes work best at middle-to-late transformer layers (commonly ~2/3 depth). This module exposes the function the trainer uses to generate candidates for automatic layer selection.
Layer indices follow Hugging Face’s hidden_states convention, where
0 is the embedding layer and 1..num_hidden_layers are transformer-block
outputs. Embeddings are excluded as they rarely yield useful probes.
- rhscope.training.layer_select.candidate_layers(num_hidden_layers)[source]¶
Return a sorted, deduplicated list of candidate layer indices.
- Parameters:
num_hidden_layers (int) –
model.config.num_hidden_layers. Must be positive.- Returns:
List of indices sampled from positions
[n/3, n/2, 2n/3, 3n/4, n], with the embedding layer (0) excluded. For very small models the list may contain fewer than 5 unique indices.- Raises:
ValueError – If
num_hidden_layersis not positive.- Return type: