Flexcompute Simulation Blog

Agentic Photonic Design: Replicating an Inverse Designed Grating Coupler

Written by Tom Chen, PhD | May 26, 2026 at 1:32 PM

When a strong paper proposes an interesting photonic device, the first thing I usually want to do is reproduce it and see whether it can be adapted for our own applications. Traditionally, that means reading the paper carefully, pulling out every detail about the platform and the design method, and rebuilding the simulation by hand so it lines up with the original.

I wanted to see how much of that process a coding agent could handle. So I gave it a paper, asked it to reproduce the device using Tidy3D, and stayed in the loop for the physics checks and validation.

The target was the vertical coupler from S.-Y. Huang and S. Barz, "Compact inverse designed vertical coupler with bottom reflector for sub-decibel fiber-to-chip coupling on silicon on insulator platform," Scientific Reports 15, 2925 (2025). It is a strong result: a compact 14 um x 14 um inverse-designed grating-style coupler with a bottom reflector, optimized for highly efficient normal-incidence fiber-to-chip coupling.

I downloaded the paper and pointed Codex at it. The request was simple: read the paper, understand the device, and write a Tidy3D script that replicates the design as closely as possible. Codex drafted the simulation and optimization, confirmed the details with me, and launched the optimization loop.

Six hours and 247 optimization iterations later, it arrived at a final design whose simulated performance closely matched the paper. The coupler shows a flat-top coupling response below 0.2 dB loss and a 1 dB bandwidth above 30 nm. The agent handled most of the workflow, with my supervision focused on the physics and validation checkpoints.

Why this was a good agentic AI test

Inverse design is a demanding workflow. Syntactically correct code is not the bar. The simulation needs the right geometry, source, monitors, boundary conditions, symmetries, materials, optimization workflow, etc. If any of these is off, the run either fails outright or, worse, produces a plausible-looking result for the wrong device.

A capable agent has to read the paper and pull out the physical parameters, turn those into a runnable Tidy3D simulation, apply the right adjoint optimization workflow, generate diagnostic plots before spending a lot of time running the simulations, accept corrections during setup, monitor long-running jobs, save results, and run post-optimization validation. That is a lot to get right.

What felt different from ordinary code generation was that the agent did not just write a script and stop. It managed the full design loop.

Step 1: Extracting the design from the paper

The device is an SOI vertical coupler with a 220 nm silicon device thickness, a 150 nm fixed silicon slab, a 70 nm shallow-etched inverse-designed top layer, and a 14 um x 14 um design region. Light couples in and out through a 450 nm wide strip waveguide, with a bottom PEC reflector placed below the BOX. The source is a normally incident Gaussian beam with 10.4 um mode-field diameter, representing a single mode fiber. The optimization objective is defined over five wavelengths: 1540, 1545, 1550, 1555, 1560 nm.

Some details were not fully specified in the paper, so the agent picked conservative defaults: a 50 nm topology pixel size (three pixels across the 150 nm minimum feature size) and a 35 nm vertical mesh through the device layer (two cells across the 70 nm shallow etch). These were not blind choices. The agent produced plots and summaries so I could inspect the setup and push back on assumptions before kicking off the full optimization.

Step 2: Building the Tidy3D inverse-design script

The main script is a standard Tidy3D Python workflow: 


The final optimization and validation runs used Tidy3D 2.11.2.

The topology pipeline:

symmetric_params = 0.5 * (params + params[:, ::-1])

filtered = conic_filter(symmetric_params)

density = tanh_projection(filtered, beta=beta, eta=0.5)

eps = rescale(density, EPS_SIO2, EPS_SI)

This produces a differentiable density field in the `70 nm` top silicon layer. The structure goes into the simulation with:

td.Structure.from_permittivity_array(

    geometry=design_box,

    eps_data=eps_data,

)

The objective is the mean power coupled into the backward-propagating fundamental strip-waveguide mode:

amps = sim_data["wg_mode"].amps.sel(direction="-", mode_index=0).values

fom = anp.mean(anp.abs(amps) ** 2)

The optimizer maximizes that mean across the five design wavelengths.

Step 3: Sanity-checking the geometry before optimization

Before sending anything to the cloud, the agent generated cross-section plots so I could verify the simulation matched the intended device.

This step mattered. A paper reproduction can fail quietly. A source in the wrong medium, a missing slab, a misplaced monitor, or a wrong symmetry condition can each produce a clean-looking script that simulates the wrong thing.

The setup plots covered the top optimized layer, the silicon slab mid-plane, an x-z cross-section through the grating region, the bottom reflector position, the Gaussian source placement, and the output waveguide with its mode monitor.


This was one of the more useful parts of the agentic workflow. I could inspect a plot, point out a physical issue, and have the simulation code updated immediately, without grepping through hundreds of lines of setup code to find the line that mattered.

Step 4: Running the optimization

The optimization followed the paper's continuation workflow: 60 grayscale L-BFGS-B iterations followed by 187 binarization iterations, for 247  total accepted iterations across 12 beta-continuation stages, with beta ramped from 1 to 64.

The optimization history was saved after every accepted step, which meant the run could be inspected, resumed, and replotted later without re-running anything expensive.

The FOM climbed quickly at first. -3 dB by iteration 12. -1 dB by iteration 30. -0.5 dB by iteration 67. -0.3 dB by iteration 120. Final FOM was -0.230 dB at iteration 247.

What agentic AI changed in the workflow

The benefit was not that the agent knew the final design in advance. It did not. The benefit was that the workflow kept moving. The agent pulled the design parameters from the paper, wrote the first inverse-design script, generated the geometry plots I needed to spot mistakes, incorporated my corrections, launched and monitored long cloud jobs, and turned raw simulation data into the figures used in this writeup.

My role stayed where it should be. I made the physics calls: whether to model the oxide cladding, what symmetry was appropriate, whether the Gaussian source placement was reasonable, and whether the partially etched region behaved as expected. The agent made those decisions cheaper to test.

That is the right framing for this kind of tool. The agent does not replace photonics intuition. It shortens the loop around it.