You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(models): linear-default DenseLayer + residual BERT blocks green model-family shards
Roots out the shared cause of the generated ModelFamily shard collapses.
1) DenseLayer<T> defaulted its activation to ReLU when none was supplied (and
activationFunction: null ALSO resolved to ReLU). Every output/logit head and
'linear projection (no activation)' site across the LayerHelper factories therefore
silently applied ReLU, clamping negative pre-activations to zero. Under the deterministic
test-init seed a pooled/head projection is negative -> all-zero output -> identical outputs
plus zero gradient (dead-ReLU), failing DifferentInputs, GradientFlow, Training,
LossStrictlyDecreases, etc. Fix: default (and null) -> IdentityActivation, matching PyTorch
nn.Linear / Keras Dense. Nonlinear hidden layers now pass an explicit activation
(CompiledTapeTrainingStepTests updated to pass ReLU explicitly).
2) The BERT-family factories built a residual-FREE transformer stack (MHA -> LN -> FFN -> LN,
no skip), so a 12-layer encoder had no gradient highway and collapsed to a uniform,
input-insensitive output after a few steps. Fix: SEC-BERT/FinancialBERT, FinBERT and
FinBERTTone factories now emit paper-faithful TransformerEncoderBlock<T> (residual
attention + residual GELU-FFN + per-sublayer LayerNorm, linear FFN output); the models'
ExtractLayerReferences updated to one composite block per layer.
3) Test scaffolding: token-based models (financial-NLP BERTs, language models) are
EmbeddingLayer-first and consume integer token IDs. Feed token-ID input in
FinancialNLPTestBase and the generator's isLang branch (continuous input drives the
embedding's projection path where scale-invariant LayerNorm collapses constant inputs).
FinancialNLPTestBase also runs MoreData at smoke scale (1/2 iters) since BERT-base's
50+200 iters exceed the 120s CPU envelope (time-budget reduction, not a correctness change).
Verified locally: FinancialBERT/FinBERT/SEC-BERT/FinBERTTone 27/27 each, EagleLanguageModel
21/21, 249 layer integration tests green.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
0 commit comments