Skip to content

Time-phase intervention scoping (gap #3) #49

Description

@alirezabayatmk

Tracks capability gap #3 from the refactor audit: the post-refactor Intervene step applies at every forward step with no way to scope the intervention to a phase of generation (prompt vs generated tokens, or a specific token index).

Supersedes #27 (@akatief's original pre-refactor ask against the old Location.token_pos API): closed as not-planned-in-that-form. This issue tracks the same intent against the current Pipeline + Step architecture.

Requirement

Let callers scope an Intervene step to:

  • phase="prompt": only during prompt processing
  • phase="generation": only on generated tokens
  • phase="all": every step (current behaviour, default)
  • phase=<int>: a specific generation step index

Core use case: activation patching, where you intervene only during the prompt pass and read the downstream effect on generation.

Design notes

  • The Intervene step should stay agnostic of how phases resolve to concrete indices. A new phase keyword must not require changes to Step internals: add phases by extending the resolver, not the Step.
  • The phase→indices resolver should always return a concrete List[int], never slice. Concrete lists make logged token positions readable and remove slice/list branching at call sites. Design input from closed PR Refactor/37 list location resolution #43 (@adham137).

Porting sources

0.1.0-blocking: one of the 5 capability gaps the refactor is missing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions