Steps — Train
Train step: computes directions from recorded activations.
SteeringResult
Section titled “SteeringResult”Output of SteeringVector step.
Attributes:
direction_per_layer:{Node: tensor [d_model]}normalized direction,- keyed by component address.
separation_scores:{Node: float}how well the direction separates- classes.
best_layer: :class:Nodewith the highest separation score.
__init__
Section titled “__init__”def __init__(self, direction_per_layer: dict[Node, Tensor], separation_scores: dict[Node, float], best_layer: Node) -> None:SteeringVector
Section titled “SteeringVector”Find a steering direction via contrastive mean difference.
Reads from results:
results['record']: ActivationStore (must have .positive and .negative)
Writes to results:
results['steering']: SteeringResult
Args:
method: Estimation method. Currently only"contrastive_mean_diff"- is supported.
normalize: If True, normalize each stored per-layer direction to unit- norm. Note the intervention functions (
steer_direction/ ablate_direction) unit-normalize again at apply time, sonormalize=Falseonly affects the magnitude of the stored vector- (e.g. if you read
direction_per_layeryourself); it does not - change steering or ablation strength.
Raises:
ValueError: Ifmethodis not a supported value.
__init__
Section titled “__init__”def __init__(self, method: str = 'contrastive_mean_diff', normalize: bool = True):