Skip to content

refactor(notebooks): use internal adam for autograd25#520

Merged
marcorudolphflex merged 1 commit into
developfrom
refactor-autograd25-internal-adam
Jun 18, 2026
Merged

refactor(notebooks): use internal adam for autograd25#520
marcorudolphflex merged 1 commit into
developfrom
refactor-autograd25-internal-adam

Conversation

@marcorudolphflex

@marcorudolphflex marcorudolphflex commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Summary

This extracts the Autograd25WaveguideCrossing.ipynb changes from #465 into a standalone PR.

  • Replaces the direct optax optimizer setup and manual update loop with Tidy3D's internal adam and optimize helpers.
  • Removes the notebook-level optax dependency.
  • Updates the Gaussian source bandwidth from f0 / 20 to f0 / 5, matching the refactor(notebooks): use internal adam and optimize helper - batch 4 #465 note that this avoided glitchy transmission values above 1.

Autograd25 Result From #465

Objective (max.): develop 9.6852e-01 vs. branch 9.4947e-01 (-1.97%).

develop:

image

branch:

image

Validation

  • uvx ruff format --check --diff Autograd25WaveguideCrossing.ipynb
  • uvx ruff check Autograd25WaveguideCrossing.ipynb
  • uv run --no-project python scripts/sync_metadata_tags.py --check
  • uv run --no-project python scripts/validate_notebook_metadata.py Autograd25WaveguideCrossing.ipynb
  • uv run --no-project python scripts/check_notebook_private_paths.py Autograd25WaveguideCrossing.ipynb
  • python3 misc/check_misc_references.py
  • uv run spellcheck.py Autograd25WaveguideCrossing.ipynb

Note

Low Risk
Documentation-only example refactor with no library or auth changes; the wider source bandwidth only affects this notebook’s simulation numerics.

Overview
Autograd25WaveguideCrossing.ipynb now follows the same autograd optimization pattern as other inverse-design examples: imports adam and optimize from tidy3d.plugins.autograd, builds an adam(learning_rate=...) optimizer, and runs the loop via optimize(...) with bounds, maximize direction, and a step callback instead of a hand-rolled optax update loop. The notebook no longer depends on optax.

The horizontal mode source GaussianPulse bandwidth is widened from fwidth=freq0 / 20 to freq0 / 5 to avoid unphysical transmission above 1; related markdown describes the optimize helper rather than manual optimizer state management.

Reviewed by Cursor Bugbot for commit f8cb9ba. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions

Copy link
Copy Markdown
Contributor

Spell check passed successfully for 1 notebook(s).
Generated by GitHub Action run: https://github.com/flexcompute/tidy3d-notebooks/actions/runs/27749382577

@marcorudolphflex marcorudolphflex marked this pull request as ready for review June 18, 2026 09:23

@groberts-flex groberts-flex left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you @marcorudolphflex

@marcorudolphflex marcorudolphflex merged commit fe32bcc into develop Jun 18, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants