Skip to content

docs: add boot_native train-from-scratch recipe to migration guide - #1600

Open
priyanka25aug wants to merge 1 commit into
TransformerLensOrg:dev-4.xfrom
priyanka25aug:docs/migration-api-recipes
Open

docs: add boot_native train-from-scratch recipe to migration guide#1600
priyanka25aug wants to merge 1 commit into
TransformerLensOrg:dev-4.xfrom
priyanka25aug:docs/migration-api-recipes

Conversation

@priyanka25aug

Copy link
Copy Markdown

Closes #1557

The migrating_to_v3.md on dev-4.x already has 13 API migration table rows and 4 runnable prose recipes, but boot_native / TransformerBridgeConfig only appeared as a table row with no runnable before/after snippet.

This PR adds the missing ### Build a TL-native model from scratch recipe, showing the direct replacement for HookedTransformerConfig + HookedTransformer(cfg). Notes included: no HF Hub call, cfg.seed reproducibility, TypeError on legacy config objects, and bridge.init_weights() for re-randomisation.

Base branch: dev-4.x (targets the v4 preview line where the rest of the migration API section lives).

@priyanka25aug

Copy link
Copy Markdown
Author

@jlarson4 — tagging you for review when you get a chance. This adds the missing boot_native / TransformerBridgeConfig runnable recipe to the migration guide (closes #1557). CI is running on dev-4.x. No rush!

@jlarson4 jlarson4 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @priyanka25aug, great work on this! Just a couple small documentation items to update before I merge this. The example itself is well built, thank you for your hard work on this

import. `cfg.seed` seeds the weight initialiser; omitting it lets the
global RNG advance normally. Passing a `HookedTransformerConfig` (or any
other legacy config object) to `boot_native` raises `TypeError` — construct
a `TransformerBridgeConfig` directly. To re-randomise weights after

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Under this recipe's own seed=42, init_weights() regenerates identical weights. 0 of 38 parameters changed when I ran it because it rebuilds its generator from cfg.seed. Can you please match the table row's "reinitialize in place" wording (migrating_to_v3.md line 240) and note that re-randomising needs a changed or cleared seed?

```

`boot_native` makes no HuggingFace Hub call and requires no `transformers`
import. `cfg.seed` seeds the weight initialiser; omitting it lets the

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HT's init_weights calls torch.manual_seed(cfg.seed) globally, while boot_native forks the RNG, so a training loop migrated verbatim silently loses reproducible data shuffling. Could this note state that difference explicitly?

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.

2 participants