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

Confusion over what generation currently does #193

Open leogagnon opened 1 month ago

leogagnon commented 1 month ago

Hi, I'm a bit confused by the comment that means, we intervene on every generated tokens! here https://github.com/stanfordnlp/pyvene/blob/31d3986e5b0b3d812eef8fdd0c39759fa1c1b58e/pyvene/models/intervenable_base.py#L2020C1-L2022C41. From what I understand setting unit_locations = {"base": 0} leads to intervening only on the first token, not on every generated token. Am I understanding right?

Also am I right in saying that intervening on the last generated token is not currently supported? This is how I interpreted this comment https://github.com/stanfordnlp/pyvene/blob/31d3986e5b0b3d812eef8fdd0c39759fa1c1b58e/pyvene/models/intervenable_base.py#L1989C1-L1991C29.

Thanks,