Repository navigation
Include the skip connection in the Multi-TopK reconstruction - #145
Open
flyingdoubleG wants to merge 1 commit into
Open
flyingdoubleG wants to merge 1 commit into
flyingdoubleG wants to merge 1 commit into
Conversation
The main TopK reconstruction adds `x @ W_skip.mT` when skip_connection is enabled, but the Multi-TopK decode with 4k latents did not. Since the training loss includes `multi_topk_fvu / 8`, a skip-connected coder with multi_topk=True was trained to reconstruct with its 4k latents the part of the target that W_skip already predicts, and multi_topk_fvu was reported against the wrong reconstruction. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Problem
With
skip_connection=True,SparseCoder.forwardadds the skip term to the main TopK reconstruction:The Multi-TopK branch re-decodes with
4 * klatents but does not add it:The trainer optimizes
fvu + auxk_alpha * auxk_loss + multi_topk_fvu / 8. So for a skip-connected coder withmulti_topk=True, typically a skip transcoder, the Multi-TopK term trains the 4k latents to reconstruct the part of the target thatW_skipalready predicts. That conflicts with the main objective, and the loggedmulti_topk_fvuis measured against the wrong reconstruction.Repro on CPU: set
W_skip = IandW_dec = 0, so that the skip connection alone reconstructs the input exactly:Fix
Add the skip term to the Multi-TopK reconstruction, as in the main branch.
Test
tests/test_multi_topk.py::test_multi_topk_fvu_includes_skip_connectionchecks two things:multi_topk_fvuequals the FVU of the 4k decode plus the skip term.It fails on
mainand passes with the fix (CPU, eager decoder).tests/test_auxk_loss.pystill passes.🤖 Generated with Claude Code