Describe the bug
Base on dev-4.x. Booting a native gpt2 bridge (the HookedTransformer train-from-scratch replacement) inits weights at the wrong scale. The initializer_range = -1.0 sentinel is never resolved on the bridge path, so native falls back to std=0.02 instead of HT's 0.8/sqrt(d_model); xavier/kaiming also ignore initializer_range as the gain. Migrated init-sensitive experiments (grokking, superposition) become silently irreproducible.
Code example
from transformer_lens.model_bridge import TransformerBridge
from transformer_lens.config import TransformerBridgeConfig
# init_mode defaults to "gpt2"; initializer_range left at the -1.0 sentinel.
# (architecture stays native — boot_native rejects architecture="gpt2".)
cfg = TransformerBridgeConfig(
d_model=768, d_head=64, n_heads=12, n_layers=2, n_ctx=32, d_vocab=50257, act_fn="gelu"
)
bridge = TransformerBridge.boot_native(cfg)
std = bridge.W_E.std().item()
# native uses ~0.02; HT uses 0.8/sqrt(768) ≈ 0.0289
System Info
Installed from source; any OS; Python 3.10+. (Reproduces on the current dev / bridge.)
Expected behaviour & fix pointer
Native std/gain must match HT. Resolve the -1.0 sentinel in TransformerBridgeConfig itself, mirroring the resolution logic at transformer_lens/config/hooked_transformer_config.py:314-319 (do not overwrite an initializer_range the user set explicitly); thread cfg.initializer_range as the gain into native/init.py:34-39,81-84, mirroring HookedTransformer.py:1547,1569. The residual 1/sqrt(2*n_layers) scaling (init.py:74,78-80), absent in HT, is a maintainer call: drop to match, or keep and document in init.py.
Acceptance:
Additional context
Checklist
Describe the bug
Base on
dev-4.x. Booting a native gpt2 bridge (theHookedTransformertrain-from-scratch replacement) inits weights at the wrong scale. Theinitializer_range = -1.0sentinel is never resolved on the bridge path, so native falls back tostd=0.02instead of HT's0.8/sqrt(d_model); xavier/kaiming also ignoreinitializer_rangeas the gain. Migrated init-sensitive experiments (grokking, superposition) become silently irreproducible.Code example
System Info
Installed from source; any OS; Python 3.10+. (Reproduces on the current
dev/ bridge.)Expected behaviour & fix pointer
Native std/gain must match HT. Resolve the
-1.0sentinel inTransformerBridgeConfigitself, mirroring the resolution logic attransformer_lens/config/hooked_transformer_config.py:314-319(do not overwrite aninitializer_rangethe user set explicitly); threadcfg.initializer_rangeas the gain intonative/init.py:34-39,81-84, mirroringHookedTransformer.py:1547,1569. The residual1/sqrt(2*n_layers)scaling (init.py:74,78-80), absent in HT, is a maintainer call: drop to match, or keep and document ininit.py.Acceptance:
0.8/sqrt(d_model), not0.02cfg.initializer_rangeas gaininit.pytests/unit/model_bridge/test_boot_native.pyasserting resolved std/gainmake unit-testanduv run mypy .cleanAdditional context
Checklist