Repository navigation
Conversation
This branch has not been deployed
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.
Description
Granite applies
embedding_multiplierafter its embedding module returns. The native embedding hook therefore correctly captures the unscaled embedding, butActivationCache.decompose_resid()andget_full_resid_decomposition()previously treated it as the full additive embedding contribution. With a non-unit multiplier, component stacks do not sum to the residual stream and component-level direct logit attribution assigns an incorrect embedding contribution, even when output scaling is identity.This change propagates
embedding_multiplierthrough the existing HF config passthrough and applies it when constructing embedding contributions in both decomposition paths. It does not change the cached native hook, hook editing semantics, model weights, or forward execution. Models without this attribute, and identity multipliers, keep the existing behavior. The API docstrings now distinguish the residual contribution from the native hook value.The offline regressions use tiny randomly initialized models, without Hub downloads. They cover multipliers 1, 0.5 and 2; raw and compatibility-mode dense Granite; batched and batchless caches; layer-zero, final and position-sliced reconstruction; full decomposition; component DLA with
logits_scaling=1; native hook edits and forward parity; and Granite MoE component reconstruction. This PR does not address non-identity output-transform semantics in DLA or claim runtime validation of Granite hybrid models.Type of change
Validation
The initial 18-case regression selection produced 10 failed, 8 passed before the production fix. The affected validation selection after the fix and additional MoE coverage produced 377 passed, 2 deselected. The two deselected cases are unrelated wide-tensor gradient stress tests; no skip or xfail was added.
Pycln, isort, Black and
git diff --checkpassed for the change. Full-repository mypy passed: no issues found in 391 source files. The complete unit suite and full PR suite were not run locally. The two import-time SWIG deprecation warnings also appeared in the pre-fix regression run.Checklist
The unit-test checkbox remains unchecked because only the affected selection, not the complete unit suite, was run locally.