Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
tags:
|
| 4 |
+
- physics
|
| 5 |
+
- electromagnetic-simulation
|
| 6 |
+
- flow-matching
|
| 7 |
+
- photonics
|
| 8 |
+
- silicon-photonics
|
| 9 |
+
- fdtd
|
| 10 |
+
- pde
|
| 11 |
+
library_name: pytorch
|
| 12 |
+
---
|
| 13 |
+
|
| 14 |
+
# PIC-Flow
|
| 15 |
+
|
| 16 |
+
A physics-embedded flow-matching neural surrogate that replaces FDTD for full-field
|
| 17 |
+
electromagnetic prediction of silicon photonic devices. Given a permittivity map
|
| 18 |
+
$\varepsilon(x,y)$, a source-port mask, and a free-space wavelength $\lambda$, PIC-Flow
|
| 19 |
+
generates the complex $E_z$ field in a single multi-step ODE integration — typically
|
| 20 |
+
in well under a second on a single A100, vs. seconds-to-minutes for CPU FDTD.
|
| 21 |
+
|
| 22 |
+
This repo hosts the **FM + phase + residual** checkpoint from epoch 300 (the headline
|
| 23 |
+
model from the paper). All training code, dataset-generation tooling, and inference
|
| 24 |
+
notebooks live in the GitHub repo:
|
| 25 |
+
[Rizzo-Integrated-Photonic-Systems-Lab/PIC-Flow](https://github.com/Rizzo-Integrated-Photonic-Systems-Lab/PIC-Flow).
|
| 26 |
+
|
| 27 |
+
## Files
|
| 28 |
+
|
| 29 |
+
| Path | Description |
|
| 30 |
+
|---|---|
|
| 31 |
+
| `checkpoints/phase_residual_300.pt` | FM+phase+residual U-Net, epoch 300, ~1 GB. |
|
| 32 |
+
|
| 33 |
+
## Quick usage
|
| 34 |
+
|
| 35 |
+
```bash
|
| 36 |
+
pip install huggingface_hub torch numpy
|
| 37 |
+
```
|
| 38 |
+
|
| 39 |
+
```python
|
| 40 |
+
from huggingface_hub import hf_hub_download
|
| 41 |
+
import torch
|
| 42 |
+
|
| 43 |
+
ckpt_path = hf_hub_download(
|
| 44 |
+
"RizzoLab/PIC-Flow",
|
| 45 |
+
"checkpoints/phase_residual_300.pt",
|
| 46 |
+
)
|
| 47 |
+
ckpt = torch.load(ckpt_path, map_location="cpu", weights_only=False)
|
| 48 |
+
# ckpt["state_dict"] -> model weights (real-valued U-Net, 63.3M params)
|
| 49 |
+
# ckpt["stats"] -> field/permittivity normalization stats
|
| 50 |
+
# ckpt["args"] -> training hyperparameters
|
| 51 |
+
```
|
| 52 |
+
|
| 53 |
+
End-to-end inference (load model, build conditioning, run flow-matching sampler) is
|
| 54 |
+
covered by [`tools/predict_parametric_device.py`](https://github.com/Rizzo-Integrated-Photonic-Systems-Lab/PIC-Flow/blob/main/tools/predict_parametric_device.py)
|
| 55 |
+
and [`notebooks/03_inference.ipynb`](https://github.com/Rizzo-Integrated-Photonic-Systems-Lab/PIC-Flow/blob/main/notebooks/03_inference.ipynb)
|
| 56 |
+
in the GitHub repo.
|
| 57 |
+
|
| 58 |
+
## Model
|
| 59 |
+
|
| 60 |
+
- **Architecture**: real-valued U-Net, 63.3M parameters. Real and imaginary $E_z$ are
|
| 61 |
+
separate input channels; permittivity and source-mask maps are visible at every layer;
|
| 62 |
+
flow-matching integration time $t$ and wavelength $\lambda$ are scalar conditioning inputs.
|
| 63 |
+
- **Generative framework**: conditional flow matching (Lipman et al., 2023). Inference
|
| 64 |
+
integrates a learned velocity field from Gaussian noise to a physically valid $E_z$
|
| 65 |
+
using Euler or Heun ODE steps.
|
| 66 |
+
- **Physics constraint**: masked Helmholtz residual loss
|
| 67 |
+
$\mathcal{L}_\text{res}$ (PML, source, and dielectric-interface pixels excluded), with
|
| 68 |
+
per-sample compliance metric $\rho_R = \sqrt{\mathcal{L}_\text{res}} \times 100\%$.
|
| 69 |
+
|
| 70 |
+
## Training data
|
| 71 |
+
|
| 72 |
+
- 22,500 Meep FDTD simulations at $\lambda = 1.55\,\mu$m
|
| 73 |
+
- Three device families: $2\times2$ MMIs, Y-branches, directional couplers (7,500 each)
|
| 74 |
+
- Latin-hypercube parameter sweeps over geometric variables per family
|
| 75 |
+
- 18,000 / 2,250 / 2,250 train / val / test split
|
| 76 |
+
|
| 77 |
+
Training: 300 epochs on 12 NVIDIA V100 GPUs, identical hyperparameters across the three
|
| 78 |
+
ablation runs (FM only, FM+phase, FM+phase+residual).
|
| 79 |
+
|
| 80 |
+
## Performance
|
| 81 |
+
|
| 82 |
+
On the held-out test split (200-step Heun sampler):
|
| 83 |
+
|
| 84 |
+
| Device family | $\rho_R$ |
|
| 85 |
+
|---|---|
|
| 86 |
+
| $2\times 2$ MMI | 2.7% |
|
| 87 |
+
| Y-branch | 2.5% |
|
| 88 |
+
| Directional coupler | 2.2% |
|
| 89 |
+
|
| 90 |
+
Out-of-distribution (same checkpoint, geometries never seen during training):
|
| 91 |
+
|
| 92 |
+
| Device | $\rho_R$ |
|
| 93 |
+
|---|---|
|
| 94 |
+
| Aggressive Euler S-bend (tight $R$, large offset) | 12% |
|
| 95 |
+
| Short, steep taper | 4.0% |
|
| 96 |
+
| Long, wide taper | 3.6% |
|
| 97 |
+
| Cascaded $1\times3$ Y-branch (new device class) | 9.1% |
|
| 98 |
+
|
| 99 |
+
Wall clock on a single NVIDIA A100 (fp16 autocast, vs. 16-thread Meep FDTD on the
|
| 100 |
+
same node):
|
| 101 |
+
|
| 102 |
+
| Sampler | Wall time | Speedup | $\rho_R$ |
|
| 103 |
+
|---|---|---|---|
|
| 104 |
+
| FDTD (reference) | 5.61 s | 1.0× | (reference) |
|
| 105 |
+
| Euler 100 step | 2.19 s | 2.6× | 1.9% |
|
| 106 |
+
| Euler 20 step | 440 ms | 12.7× | 3.0% |
|
| 107 |
+
| Euler 5 step | 110 ms | 50.6× | 5.5% |
|
| 108 |
+
|
| 109 |
+
## Citation
|
| 110 |
+
|
| 111 |
+
```bibtex
|
| 112 |
+
@article{Quaratiello2026PICFlow,
|
| 113 |
+
author = {Joseph Quaratiello and Anthony Rizzo},
|
| 114 |
+
title = {A Physics-Embedded Flow-Matching Model for Electromagnetic Prediction
|
| 115 |
+
of Silicon Photonic Devices},
|
| 116 |
+
journal = {arXiv},
|
| 117 |
+
year = {2026}
|
| 118 |
+
}
|
| 119 |
+
```
|
| 120 |
+
|
| 121 |
+
## License
|
| 122 |
+
|
| 123 |
+
MIT. See [LICENSE](https://github.com/Rizzo-Integrated-Photonic-Systems-Lab/PIC-Flow/blob/main/LICENSE)
|
| 124 |
+
in the GitHub repo.
|