fix: filter weight decay for LayerNorm, biases, and special tokens #66
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Problem
The current training applies
weight_decay=0.05to ALL parameters, including:This is suboptimal because:
probe(shape 1,1,C) shouldn't be shrunk toward zeroSolution
Add
build_adamw_param_groups()function that:param.ndim < 2(catches all 1D params).biassuffixprobe, pos_embed, cls_token, mask_token, query_tokens, latentsEvidence from Major Repos
p.ndim == 1+no_weight_decay_listno_weight_decay()p.ndim < 2kernel(weight matrices)Files Changed
training/train.py- Add helper function and modify optimizer setupEdge Cases Handled
probein pooling head: shape (1, 1, C) with ndim=3, explicitly excluded by namebias=False, no issue