interlens.interp.patching¶
interlens.interp.patching
¶
Patch
dataclass
¶
Activation patching: overwrite a decoder layer's residual at specific token positions with saved
activations (captured from another run/branch).
This is the cross-branch causal-tracing primitive: capture activations at turn N in one branch (via
ActivationCache), then inject them at the aligned positions of another branch's forward. The harness owns
this because only it knows the turn/position correspondence between branches.
P2 applies the patch on the (single) prompt forward — positions index into the prompt sequence. Aligning
positions across branches is the caller's responsibility; Patch just performs the overwrite.