Skip to content

chore: layer_norm cleanup similar to the one for constant_norm_rescale#698

Merged
chanind merged 2 commits into
decoderesearch:mainfrom
danra:layer_norm_cleanup
Jun 16, 2026
Merged

chore: layer_norm cleanup similar to the one for constant_norm_rescale#698
chanind merged 2 commits into
decoderesearch:mainfrom
danra:layer_norm_cleanup

Conversation

@danra

@danra danra commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

Checklist:

  • My changes generate no new warnings
  • New and existing tests pass locally with my changes

You have tested formatting, typing and tests

  • I have run make check-ci to check format and linting. (you can run make format to format code if needed.)

Copilot AI review requested due to automatic review settings June 7, 2026 18:08

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Updates the runtime activation layer-norm output path in the SAE implementation, adding attribute deletion after applying stored normalization parameters.

Changes:

  • Replace direct return expression with an in-place assignment then return
  • Delete self.ln_mu and self.ln_std inside run_time_activation_ln_out after first use

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread sae_lens/saes/sae.py
Comment on lines +352 to +355
x = x * self.ln_std + self.ln_mu # type: ignore
del self.ln_mu
del self.ln_std
return x

@chanind chanind left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks reasonable, but could we add a test on this as well so we don't regress?

@danra danra force-pushed the layer_norm_cleanup branch from 43d9d65 to fd28a63 Compare June 9, 2026 18:58
@danra

danra commented Jun 14, 2026

Copy link
Copy Markdown
Contributor Author

This looks reasonable, but could we add a test on this as well so we don't regress?

Done

@chanind chanind left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this!

@chanind chanind merged commit e712428 into decoderesearch:main Jun 16, 2026
4 of 5 checks passed
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.

3 participants