refactor(notebooks): use internal adam for autograd27 smatrix#521
Merged
marcorudolphflex merged 1 commit intoJun 18, 2026
Merged
Conversation
Contributor
|
Spell check passed successfully for 1 notebook(s). |
24fd2b6 to
fa22e8c
Compare
groberts-flex
approved these changes
Jun 18, 2026
groberts-flex
left a comment
Contributor
There was a problem hiding this comment.
looks good thanks @marcorudolphflex
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.
Summary
This updates
Autograd27Smatrix.ipynbas a standalone extraction from #465.optaxoptimizer setup and manual update loop with Tidy3D's internaladamandoptimizehelpers.learning_rate = 0.04, which avoids the large objective spike seen with the earlier0.05rerun.optaxdependency.Optimization Result
Lower-LR internal-Adam rerun, final saved step:
25J:2.6270e-02(vs 1.0909e-02 before)1.5076e-02before
after

Validation
uvx ruff format --check --diff Autograd27Smatrix.ipynbuvx ruff check Autograd27Smatrix.ipynbuv run --no-project python scripts/sync_metadata_tags.py --checkuv run --no-project python scripts/validate_notebook_metadata.py Autograd27Smatrix.ipynbuv run --no-project python scripts/check_notebook_private_paths.py Autograd27Smatrix.ipynbpython3 misc/check_misc_references.pyuv run spellcheck.py Autograd27Smatrix.ipynbNote
Low Risk
Notebook-only refactor with no production code paths; main review note is that the rerun yields a higher final objective than before, which is expected from the hyperparameter change rather than a functional regression.
Overview
Autograd27Smatrix.ipynb now follows the same optimization pattern as other autograd examples: the inverse-design loop uses
tidy3d.plugins.autogradadamandoptimizeinstead of a third-partyoptaxsetup and hand-written update steps.The optimization cell wires
record_stepas aoptimizecallback (density plots plus step logs for J, beta, and gradient norm) and keeps parameters in [0, 1] viabounds.learning_rateis set to0.04for the rerun (replacing0.05), which the author reports avoids a large objective spike. Committed outputs were refreshed for the new run (e.g. final step 25, J ≈ 2.63e-02).This is documentation/example-only: no library or simulation API changes.
Reviewed by Cursor Bugbot for commit fa22e8c. Bugbot is set up for automated code reviews on this repo. Configure here.