Add Starcoder2 architecture adapter - #1533
Merged
jlarson4 merged 2 commits intoJul 28, 2026
Merged
Conversation
dev gained an independently-written Starcoder2 adapter in TransformerLensOrg#1542 while this PR was open, so the two collided on every file here. Reconciled onto the TransformerLensOrg#1542 base, keeping the parts of this PR that TransformerLensOrg#1542 was missing: - ARCHITECTURE_DESCRIPTIONS entry for Starcoder2 (TransformerLensOrg#1542 registered the adapter but never described it in the model registry report). - Unit coverage for the attention mapping, the exact weight-conversion key set (including the absence of a per-head o.bias reshape), the ln2 norm, and the MHA fallback when n_key_value_heads is absent. - The GPTBigCode contrast in the module docstring. Dropped as superseded by TransformerLensOrg#1542's implementation: the hand-rolled q/k/v bias conversions (base _qkvo_weight_conversions(include_biases=True) emits the same kv-head-aware reshapes), the setup_component_testing override (the _testing_eager class attribute drives the shared base wiring and also forces eager attention), and the default_config block (dead — the base class merges default_cfg, so nothing ever read it). Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Collaborator
|
Hey @SanjidMzi! Thanks for putting this together. A Starcoder2 adapter was added independently from this, but I have rebased your PR |
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.
Adds a TransformerBridge adapter for Starcoder2 (
Starcoder2ForCausalLM), which had no support (StarCoder1 /gpt_bigcodeis already supported).Starcoder2 is a Llama-shaped decoder (sequential pre-norm, GQA, rotary) that differs from Llama in three ways it shares with GPTBigCode: LayerNorm+bias instead of RMSNorm, a non-gated GELU MLP (
c_fc/c_proj), and biases on all projections.__init__, model registry, report).tiny-random-Starcoder2ForCausalLM(max abs diff ~1e-7, 100% argmax agreement).make format,uv run mypy ., and unit + integration + registry tests pass locally.