Skip to content

dev-4.x contribution follow ups - #1614

Merged
jlarson4 merged 4 commits into
dev-4.xfrom
test-followups
Aug 7, 2026
Merged

dev-4.x contribution follow ups#1614
jlarson4 merged 4 commits into
dev-4.xfrom
test-followups

Conversation

@jlarson4

@jlarson4 jlarson4 commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

Description

Works through the follow-up backlog from our PR reviews for the dev-4.x changes, verified against current dev-4.x. The review caught and fixed several additional bugs, including two long-standing ones nobody had seen because the affected notebooks had never executed coherently end to end.

Main changes:

  • MLP weight orientation: W_in/W_out/W_gate were raw aliases to the wrapped module's weight with no layout conversion, so every nn.Linear-backed model (all of boot_native) returned transposed weights; Conv1D models were right by luck. Now layout-aware properties on MLPBridge, tested in both aspect ratios (the bottleneck shape defeats shape heuristics).
  • boot_native init parity: gpt2-mode default std was 0.02 instead of the legacy 0.8/√d_model (toy-model training dynamics depend on this — the grokking demo memorizes vs. stalls); seeded init now generates on CPU/fp32 and copies in, so the same seed reproduces identical weights before or after .to(device)/.to(dtype); initializer_range acts as the xavier/kaiming gain like the legacy init did.
  • get_bridge_params GQA expansion: grouped K/V and biases expand to n_heads (repeat_interleave, matching HF repeat_kv pairing) so SVDInterpreter's per-head OV pairing is correct on GQA models; non-divisible head counts raise instead of silently floor-dividing.
  • Hook alias fallback chains: hook_aliases targets can be a priority-ordered list; OLMo-Hybrid's hook_mlp_out now resolves to ln2_post.hook_out on post-norm layers and falls back to mlp.hook_out on linear-attention layers.
  • Smaller fixes: audio benchmarks take feature-extractor-driven input (AST-style spectrogram models can verify); enable_compatibility_mode() on audio models raises a clear NotImplementedError instead of a KeyError; bias-free checkpoint stacking raises an actionable error that now survives __getattr__ (CPython discards the original diagnostic otherwise); print(bridge) no longer crashes (__str__ called a method that never existed); train() works on a config copy instead of mutating the caller's; dead _set_processed_weight_attributes removed.
  • Doctests: executable examples ported to TransformerBridge (merged with docs: migrate executable doctests to TransformerBridge #1576's version of the same migration; conflicts resolved in its favor), a decorative comment-only doctest in ActivationCache made live, and a repo guard test that fails if any surviving module's doctest references HookedTransformer.
  • Grokking + No_Position notebooks ported to boot_native and actually green (96/96 and 30/30 under nbval). Three root causes found along the way:
    1. The "causes CI to hang" mystery was tqdm's 25k updates tripping Jupyter's IOPub rate limiter into >5s silent gaps, which nbval's hard-coded output-wait reads as a hang.
    2. doc_sanitize.cfg's device-string stripper has never loaded — nbval's parser requires a space after replace:, so regex4 silently didn't exist. One-character fix.
    3. Grokking's cell 70 hardcoded key_freqs = [17, 25, 32, 47] from a past run — which matched neither observable model (HEAD's own stored norms plot shows different frequencies). The notebook now detects key frequencies from the embedding norms, and the restricted/excluded-loss cells finally demonstrate the canonical result against their own model (restricted 1.19e-07, excluded 5.07).
      Notebook diffs are stripped to necessary changes only (metadata/execution counts/env-specific outputs reverted to HEAD wherever nbval provably never compares them).
  • CI: nightly slow-tier workflow (slow-tests.yml) — scheduled + manual dispatch, HF cache chained to the existing key, swap + disk reclaim, concurrency-guarded, with the >16GB-RAM adapters explicitly ignored until we have a large runner. Note the cron only fires once this reaches main; dispatch works before that.
  • Docs: the NSP section of the migration guide now states what the code actually does (the high-level NSP API requires the legacy encoder surface and is not yet ported).

Deferred with reasons (tracked in the plan doc): GIDD's ScaledLinear scale needs the real hub class to verify before touching; copy-split staleness, storage-identity load grouping, muP native init, and SSM primitive generalization are issue-shaped product work.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes (unit 5163 post-merge with dev-4.x; mypy clean on 422 files; doctests incl. the gpt2-booting evals example; Grokking 96/96 and No_Position 30/30 under nbval)
  • I have not rewritten tests relating to key interfaces which would affect backward compatibility

@jlarson4
jlarson4 merged commit 82104b8 into dev-4.x Aug 7, 2026
49 of 50 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.

1 participant