Skip to content

Add Function Vectors reproduction example notebook - #667

Open
Devansh-Ruia wants to merge 5 commits into
ndif-team:mainfrom
Devansh-Ruia:examples/function-vectors-reproduction
Open

Add Function Vectors reproduction example notebook#667
Devansh-Ruia wants to merge 5 commits into
ndif-team:mainfrom
Devansh-Ruia:examples/function-vectors-reproduction

Conversation

@Devansh-Ruia

@Devansh-Ruia Devansh-Ruia commented May 20, 2026

Copy link
Copy Markdown

Adds examples/function_vectors_reproduction.ipynb, which reproduces the function vector extraction from Todd et al. (ICLR 2024) using nnsight's tracing API.

What this does

  • Loads [model name you used], extracts a function vector for the [task name] task using N in-context demonstrations
  • Injects the FV into a zero-shot context and measures the task-completion delta
  • Documents one place where the nnsight port deviates from the original PyTorch hook implementation

Why

The repo has no published example linking a paper's specific result to nnsight idioms. This notebook closes that gap for Function Vectors and gives new users a reference for the trace-and-intervene pattern on real interpretability work.

How it was tested

  • Runs end-to-end on a clean kernel restart
  • All cells produce output
  • Tested on Collab A100

Happy to revise based on review feedback. First contribution to the repo.

Devansh-Ruia and others added 5 commits May 20, 2026 00:42
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