Download methods/bert2bert.md from imecai/cl-agentic-vault: direct link, hf CLI and curl.
- Browser
- Download file 5.22 kB
-
https://huggingface.co/datasets/imecai/cl-agentic-vault/resolve/main/methods/bert2bert.md
- Command line
-
hf download hf://datasets/imecai/cl-agentic-vault/methods/bert2bert.md
-
curl -L -o bert2bert.md https://huggingface.co/datasets/imecai/cl-agentic-vault/resolve/main/methods/bert2bert.md
family: architecture
introduced-in: '[[chen2021-bert2bert]]'
stores:
- nothing
requires-boundaries: 'no'
requires-task-id: 'no'
memory-growth: constant
tags:
- method
bert2BERT
What it does
Initializes a large Transformer LM from an existing trained smaller one, then pretrains it normally. Width is expanded by Net2Net-style function-preserving neuron splitting adapted to Transformers (FPI), or — better — by advanced knowledge initialization (AKI), which deliberately breaks FPI's replica symmetry by stacking sampled rows of the upper layer's widened matrix into each layer's expansion; depth is then bridged by iteratively stacking the widened model on itself. A two-stage schedule (a few epochs of randomly sampled bottom-k sub-model training, then full-model training) adds further savings. The trained small model's knowledge rides in through the initialization, so the large model reaches the from-scratch final loss with ~45% (BERT-base) / 47% (GPT-base) fewer FLOPs.
Aspects
- Stores: nothing during training. The trained source model S(Ls, Ds) is an input consumed at initialization (Ls ≤ Lt, Ds ≤ Dt); no replay memory, no snapshots kept afterward.
- Update rule: standard MLM/LM pretraining after initialization. FPI expands each weight matrix by in-dimension then out-dimension mapping (uniform sampling of source neurons to duplicate, duplicates rescaled by their multiplicity so outputs are preserved), with head-wise expansion for MHA and constraints tying the mappings of adjacent modules so residual connections stay consistent; layer-norm statistics break exact preservation by a small, ignored gap. AKI builds each expanded matrix from the widened current-layer matrix stacked with sampled rows of the widened upper-layer matrix — worse initial loss than FPI, faster convergence. Two-stage training: for Eb epochs, sample a bottom-{lb, 2lb, …, Lt} sub-model per step and update only its top lb layers plus a shared head; then train the full model.
- Requires: an existing pretrained smaller model of compatible family (source/target layer and width choices are hand-set; effect of source size and architecture left to future work); no task boundaries, identities, or stream structure — the setting is a single static corpus.
- Costs: the point is negative cost — 45.2% of BERT-base pretraining FLOPs saved (AKI + two-stage, S(12,512)→T(12,768)), 47% for GPT; savings shrink to 23.9% with a half-depth source S(6,512). No inference-time overhead; the initialization itself is a one-shot transformation.
Documented behavior
- [[chen2021-bert2bert]] (introduces): FPI-expanded models reproduce the source's MLM loss at initialization (1.89/1.70 vs sources' 1.89/1.67) where DirectCopy lands at 9.05/6.45 and random init at 10.40; FPI alone saves 30.4%, AKI 38.4%, AKI + two-stage 45.2% (avg GLUE 85.7 vs 85.5 from scratch); DirectCopy saves 12.2% with a half-width source and 0% with a half-depth one, where bert2BERT keeps 23.9%. Over-long sub-model training destroys the inherited knowledge (Eb=20: saving collapses to 25.4%, GLUE 84.3, baseline loss never reached). FPI's loss curve initially rises — read as optimization having to break the replica symmetry — while AKI avoids this; attention-pattern analyses show FPI preserving the source's patterns, AKI additionally carrying upper-layer patterns, and DirectCopy destroying them.
- [[qin2022-elle]] (adopts the width expansion): uses bert2BERT's FPI to grow the model at each corpus arrival in lifelong pretraining, but adds Gaussian noise to the copied parameters to break replica symmetry (its ablation: removing the noise slows pretraining) and a function-recovering warmup on replayed data after each expansion; its depth growth departs from stack-the-whole-model in favor of adjacent layer duplication.
Links
variant-of:: [[net2net]] (extends Net2Net's function-preserving neuron splitting from vision CNNs to Transformer PLMs — head-wise MHA expansion, coupled FFN/embedding mappings, residual-connection constraints) combines:: [[progressive-stacking]] (depth-wise expansion iteratively stacks the widened model on itself, Gong et al. 2019's move, after the width expansion) uses:: [[function-preserving-width-expansion]] (FPI: source neurons duplicated by uniform sampling and rescaled by multiplicity so the widened matrices compute the original function; the same trick ELLE later imports) uses:: [[upper-layer-parameter-mixing]] (AKI: each layer's expanded matrix stacks the widened current-layer weights with sampled rows of the widened upper layer's — breaking FPI's replica symmetry and importing adjacent-layer knowledge at the cost of exact function preservation)
Papers engaging this method
LIST FROM [[]] AND ("papers" OR "influences")