fix abnormal spike : Init res state to 1.0 #6
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.
Hello.
This Pull Request addresses an instability issue during the initial steps of training.
Problem
The current initialization of
exp_avg_res_rowandexp_avg_res_colto zero causes an abnormally large spike inres_approxat step 0 (e.g. res_approx.mean().items()=100000) , resulting in excessively large parameter updates.This large initial value leads to two problems:
Certain layers may sustain damage.
e.g., resulting in unexpected artifacts or unnatural color shifts in the output.
If the user utilizes a high
beta[2]value (e.g.,> 0.99), this initial abnormal value persists, severely hindering the optimizer's ability to return to a normal state.Changing point
Non-zero initial value is required to prevent this immediate instability. This PR sets the initial value of the
resrelated states to 1.0.This change ensures that training starts from a neutral, stable state, effectively preventing catastrophic model failure at the start of the run.