Skip to content

feature[notebooks]: add robust optimization of directional coupler with sharpness aware minimization optimizer #285

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

rahul-flex
Copy link

In this notebook, we demonstrate how to design photonic components that remain robust against manufacturing variations—represented by perturbations in the optimizable design parameters—using the Sharpness‑Aware Minimization (SAM) optimizer.

Standard optimization methods often converge to parameter values that yield low loss but reside in "sharp" minima in the loss landscape; such solutions can be highly sensitive to small perturbations and may not perform well when fabricated. Inspired by the connection between the geometry of the loss landscape and generalization, SAM seeks parameter values that lie in "flat" regions, corresponding to neighborhoods with uniformly low loss. Originally developed to improve generalization in machine learning models, SAM achieves this by minimizing both the loss value and the loss sharpness simultaneously. This inherent robustness to perturbations makes SAM suited for designing photonic devices that are tolerant to manufacturing errors, such as geometry variations in lithography.  

We will apply SAM to design a robust 50/50 directional coupler (DC), optimizing the boundaries of the coupling region defined using PolySlab structures within Tidy3D. This approach aims to produce a DC design whose performance is stable across a range of likely manufacturing variations in coupling region boundaries, drawing on the principles outlined by Foret, P., Kleiner, A., Mobahi, H. and Neyshabur, B., 2020. Sharpness-aware minimization for efficiently improving generalization. arXiv preprint arXiv:2010.01412.

Results:
We optimize for the split ratio using SAM and analyze the robustness of initial design and optimized design for geometric perturbations:
image

Copy link
Contributor

github-actions bot commented Apr 24, 2025

Spell Check Report

Sharpness_aware_minimization_directional_coupler.ipynb:

361: "        name=\"thru\",\n",
	thru ==> through
579: "    two sims (thru & cross) and return the 50/50 split error.\n",
	thru ==> through
581: "    # Build the thru & cross simulations and launch the batch run\n",
	thru ==> through
590: "    amp_thru_p1 = batch[\"port1\"][\"thru\"].amps.sel(mode_index=0, direction=\"+\").data.item()\n",
	thru ==> through
597: "    amp_thru_p2 = batch[\"port2\"][\"thru\"].amps.sel(mode_index=0, direction=\"+\").data.item()\n",
	thru ==> through
842: "        thru = np.abs(simdata[\"thru\"].amps.sel(mode_index=0, direction=\"+\").values) ** 2\n",
	thru ==> through
842: "        thru = np.abs(simdata[\"thru\"].amps.sel(mode_index=0, direction=\"+\").values) ** 2\n",
	thru ==> through
843: "        T = cross + thru\n",
	thru ==> through
845: "        splitratios = thru / cross\n",
	thru ==> through
846: "        wl = td.C_0 / simdata[\"thru\"].amps.sel(mode_index=0, direction=\"+\").f.values\n",
	thru ==> through
850: "            \"thru\": thru,\n",
	thru ==> through
850: "            \"thru\": thru,\n",
	thru ==> through
926: "    ax.plot(val[\"wl\"], val[\"thru\"], linestyle=style, label=key)\n",
	thru ==> through
955: "ax.set_ylabel(\"Split ratio (thru/cross)\")\n",
	thru ==> through
1137: "    metric=\"thru\",\n",
	thru ==> through

Checked 1 notebook(s). Found spelling errors in 1 file(s).
Generated by GitHub Action run: https://github.com/flexcompute/tidy3d-notebooks/actions/runs/14653793212

@rahul-flex rahul-flex force-pushed the rahul-flex/sam-directional-coupler branch from 525bd58 to 2bd81da Compare April 24, 2025 23:46
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.

1 participant