Fix critical architecture bugs and refactor ChaosGrad and Trainer#8
Merged
Fix critical architecture bugs and refactor ChaosGrad and Trainer#8
Conversation
…MP persistence, spectral momentum sync, and plateau escape)
…iner - Fix 4 critical bugs: AMP/Persistence scaling, Spectral Clip momentum sync, Plateau Noise magnitude, and Adaptive LR epsilon guards. - Restore learning performance for micro-architectures (MNIST Record PoC). - Generalize architecture: Parameterize all magic numbers (EMA coefficients, noise intensity, sentinel thresholds) in ChaosGrad and Trainer. - Standardize all ChaosGradConfig presets for scale-invariant performance. - Support torch.compile naming conventions in parameter classification. - Refactor comments for objective and professional documentation.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates RealNet’s training stack by expanding ChaosGrad configurability (adaptive LR smoothing, plateau behavior, and input-gradient health detection) and making RealNetTrainer gradient clipping configurable, with additional tweaks to stability-related optimizer/training logic.
Changes:
- Added new
ChaosGradhyperparameters (adaptive_ema,plateau_noise_intensity,loss_history_min,sentinel_threshold) and wired them through presets/defaults. - Refined
ChaosGradbehavior for parameter grouping, plateau noise injection, spectral clipping buffer handling, and input gradient health computation. - Added
max_grad_normtoRealNetTrainerand adjusted gradient persistence to account for AMP scaling.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
realnet/training/trainer.py |
Adds configurable grad clipping (max_grad_norm) and adjusts AMP-related gradient persistence behavior. |
realnet/training/chaos_optimizer.py |
Introduces new optimizer hyperparameters and modifies plateau/adaptive/spectral/sentinel logic for stability and configurability. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Owner
Author
|
@copilot any more? |
Contributor
|
@theomgdev I've opened a new pull request, #9, to work on those changes. Once the pull request is ready, I'll request review from you. |
Stabilize ChaosGrad defaults and preserve trainer/optimizer API compatibility
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This pull request introduces several enhancements and refinements to the
ChaosGradoptimizer and theRealNetTrainerclass to improve training stability, adaptability, and configurability. The most notable changes include the addition of new hyperparameters for adaptive learning rate smoothing, plateau noise control, and input gradient health detection, as well as improvements to parameter classification and gradient clipping logic. These updates make the optimizer more robust and flexible for diverse network architectures and training scenarios.ChaosGrad Optimizer Enhancements:
adaptive_ema(smoothing factor for adaptive LR variance),plateau_noise_intensity(multiplier for plateau noise),loss_history_min(minimum steps for loss history), andsentinel_threshold(threshold for input health detection). These are now configurable through the optimizer and preset methods. [1] [2] [3] [4] [5] [6] [7] [8]adaptive_ema).Training Logic Improvements:
max_grad_normas a configurable argument toRealNetTrainer, allowing flexible gradient clipping during training. [1] [2] [3]Stability and Robustness:
These changes collectively make the optimizer and trainer more configurable, adaptive, and robust for a wide range of use cases.