Closed nix-apollo closed 7 months ago
Todos:
We only ever need a bias position for both:
Possibly I'll postpone this and not improve the current situation in this PR.
Re: test tolerance. This was because I had accidentally made a test stricter by going from rtol=1e-5 (pytorch's default) to rtol=0 (pytest's default). Not because computation got less precise. I've reverted the change for consistency.
Centred rib
Description
center = true
, returning it in the 0th position.Related Issue
Closes #248
Motivation and Context
This is a first version of centered rib. It seems likely that we might want to handle lambda and/or edge calculation differently in the future to make the calculation more principled. For instance, the baseline for IG is still the 0 point, instead of the mean activation.
How Has This Been Tested?
I have a test that checks invariants for the output of the centered rib build. Including that there is a single constant direction pointing in the direction we expect, and that activations in all other rib directions are centered.
This code was also used for various analysis in the OP report, where it seemed to do reasonable things.
Does this PR introduce a breaking change?
Residual stream reorder may break some analysis code. No interface changes.