stanfordnlp / pyvene

Stanford NLP Python Library for Understanding and Improving PyTorch Models via Interventions
http://pyvene.ai
Apache License 2.0
652 stars 63 forks source link

[P0] Intervention scheduling for generation #110

Open nathankim7 opened 9 months ago

nathankim7 commented 9 months ago

Description

Basic functionality for scheduling interventions to happen on positions not present in the prompt (i.e. generated tokens). Ideally should follow the same procedure for GRU.

Changelog:

Testing Done

Checklist:

leogagnon commented 1 month ago

Is this PR done? I would really like to use this functionality for my ongoing project.

Also, do interventions at given time-step carry to the all the future time-steps? For example, if the token at t=5 receives an intervention, does it only last for all generation steps t<5 ? I think the answer is yes, but do you think it would be possible to make it otherwise? In other, words, I want to schedule interventions which are specific to specific time-steps and only apply for that generation step.

For example, I would want to intervene on the last token at every generation step, i.e. only intervene on the token at t=5 when generating t=6, not when generating t=7,.....

Thoughts would be appreciated