feat: add the Sweep step and rebuild the demo surface as notebooks#116
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary 📝
examples/was six loose scripts. This replaces them with fifteen notebooks, one per step/combination of steps that Murano does, all executed and published on the docs site. Those implementations caused some Murano gaps to pop up which this PR handles as well.Details
getting_started.ipynbplus fourteen innotebooks/applications/: steering, probing, logit lens, logit attribution, attention, ablation, activation patching, circuit discovery, metrics, custom pipeline, weight ablation, and three SAE ones moved out ofnotebooks/sae/. Everything runs on GPT-2 except weight ablation (Llama-3.2-1B) and two of the SAE ones (Gemma-2-2B). They share one template, enforced bytests/test_notebook_structure.py.Sweepstep. Every notebook that measured something per head was writing the same loop by hand.Sweepruns a step chain once per item and collects the metric. It copiesResultsper item so the setup runs once, and figures out itsreadsfrom the chain so a missing key fails before the model runs. Sweeping heads gives{Node: float}, the same shape attribution gives, soSelectComponentsandplot_head_matrixtake it directly andPlotdraws it.Logitsnow takesfn=, which the backend already supported, so sweeping layers costs forward passes instead of generations. AddsAnswerRankStepandSAEModel.decoder.plot_activation_projectionmoves out ofexamples/intomurano.plotting. Shared prompts live in the newmurano.tasksinstead of being pasted into each notebook.docs/scripts/gen_notebook_docs.pyrenders the executed notebooks into pages at deploy time. Also fixes the docs build, which fails onmain: three reproduction pages have an unquoteddescription:containing a colon.examples/andtests/test_examples.py, and adapting those tests to the library functions. Drops.coveragerc, which duplicated the config inpyproject.toml.Checks
Sweepgives the same numbers as the loops it replaces, andcircuit_discoverystill finds the IOI circuit. All fifteen notebooks run clean on GPT-2, Llama-3.2-1B and Gemma-2-2B.