Skip to content

feat: compose component discovery with patching and best-layer steering#113

Merged
alirezabayatmk merged 1 commit into
mainfrom
feat/discover-then-patch
Jul 8, 2026
Merged

feat: compose component discovery with patching and best-layer steering#113
alirezabayatmk merged 1 commit into
mainfrom
feat/discover-then-patch

Conversation

@alirezabayatmk

Copy link
Copy Markdown
Member

Summary 📝

Makes two more flows composable. A discovery step can pick the components to patch and hand them to Patch/PathPatch at run time, and steering can apply only the best layer's direction, so both run as one pipeline instead of two with a manual hand-off.

Details

  1. SelectComponents step and ComponentSelection artifact: rank a LogitAttribution result (by magnitude, sign, or most negative) and keep the top top_k or everything past a threshold. A modules= filter can keep heads only.
  2. Patch / Ablate take targets_key= and PathPatch takes senders_key=, reading a ComponentSelection from Results at run time. The key is added to the step's reads, so a pipeline that fails to produce it fails pre-flight with a clear KeyError instead of silently patching nothing.
  3. Intervene gets direction_layers ("all", "best", or a layer list): with direction_key it can apply only the best separating layer's direction instead of every recorded layer, which keeps deep models from degenerating.
  4. Ablate captures target activations in layer order, so a ranked selection (or any out of order targets) patches correctly.

Checks

  • Tested Changes: Verified on GPT-2, Pythia-1.4b, GPT-J-6B, Qwen2.5-7B, and Llama-2-13B.

@alirezabayatmk alirezabayatmk merged commit aed5bf8 into main Jul 8, 2026
5 checks passed
@alirezabayatmk alirezabayatmk deleted the feat/discover-then-patch branch July 8, 2026 20:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant