A collection of inverse design challenges
Project description
invrs-gym
v1.4.2
Overview
The invrs_gym
package is an open-source gym containing a diverse set of photonic design challenges, which are relevant for a wide range of applications such as AR/VR, optical networking, LIDAR, and others.
Each of the challenges consists of a high-dimensional problem in which a physical structure (the photonic device) is optimized. The structure includes typically >10,000 degrees of freedom (DoF), generally including one or more arrays representing the structure or patterning of a layer, and may also include scalar variables representing e.g. layer thickness. In general, the DoF must satisfy certain constraints to be physical: thicknesses must be positive, and layer patterns must be manufacturable---they must not include features that are too small, or too closely spaced.
In general, we seek optimization techniques that reliably produce manufacturable, high-quality solutions and require reasonable compute resources. Among the techniques that could be applied are topology optimization, inverse design, and AI-guided design.
invrs_gym
is intended to facilitate research on such methods within the jax ecosystem. It includes several challenges that have been used in previous works, so that researchers may directly compare their results to those of the literature. While some challenges are test problems (e.g. where the structure is two-dimensional, which is unphysical but allows fast simulation), others are actual problems that are relevant e.g. for quantum computing or 3D sensing.
Key concepts
The key types of the challenge are the Challenge
and Component
objects.
The Component
represents the physical structure to be optimized, and has some intended excitation or operating condition (e.g. illumination with a particular wavelength from a particular direction). The Component
includes methods to obtain initial parameters, and to compute the response of a component to the excitation.
Each Challenge
has a Component
as an attribute, and also has a target that can be used to determine whether particular parameters "solve" the challenge. The Challenge
also provides functions to compute a scalar loss for use with gradient-based optimization, and additional metrics.
Example
# Select the challenge.
challenge = invrs_gym.challenges.ceviche_lightweight_waveguide_bend()
# Define loss function, which also returns auxilliary quantities.
def loss_fn(params):
response, aux = challenge.component.response(params)
loss = challenge.loss(response)
eval_metric = challenge.eval_metric(response)
metrics = challenge.metrics(response, params, aux)
return loss, (response, eval_metric, metrics, aux)
value_and_grad_fn = jax.value_and_grad(loss_fn, has_aux=True)
# Select an optimizer.
opt = invrs_opt.density_lbfgsb(beta=4)
# Generate initial parameters, and use these to initialize the optimizer state.
params = challenge.component.init(jax.random.PRNGKey(0))
state = opt.init(params)
# Carry out the optimization.
for i in range(steps):
params = opt.params(state)
(value, (response, eval_metric, metrics, aux)), grad = value_and_grad_fn(params)
state = opt.update(grad=grad, value=value, params=params, state=state)
With some plotting, this code will produce the following waveguide bend:
Challenges
The current list of challenges is below. Check out the notebooks for ready-to-go examples of each.
- The bayer sorter chhallenge involves the design of metasurface that replaces the color filter in an image sensor, and is based on "Pixel-level Bayer-type colour router based on metasurfaces" by Zou et al.
- The diffractive splitter challenge involves designing a non-paraxial diffractive beamsplitter useful for 3D sensing, as discussed in LightTrans documentation.
- The ceviche challenges are jax-wrapped versions of the Ceviche Challenges open-sourced by Google, with defaults matching "Inverse Design of Photonic Devices with Strict Foundry Fabrication Constraints" by Schubert et al. These were also studied by Ferber et al. in "SurCo: Learning Linear SURrogates for COmbinatorial Nonlinear Optimization Problems" by Ferber et al.
- The meta-atom library challenge is baed on "Dispersion-engineered metasurfaces reaching broadband 90% relative diffraction efficiency" by Chen et al., and involves the design of 8 meta-atoms for
- The metagrating challenge is a re-implementation of the Metagrating3D problem using the fmmax simulator.
- The metalens challenge is a re-implemenation of the RGB Metalens problem using the fmmax simulator. constructing a broadband, polarization-insensitive grating.
- The photon extractor challenge is based on "Inverse-designed photon extractors for optically addressable defect qubits" by Chakravarthi et al., and aims to create structures that increase photon extraction efficiency for quantum applications.
Install
pip install invrs_gym
Testing
Some tests are marked as slow and are skipped by default. To run these manually, use
pytest --runslow
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file invrs_gym-1.4.2.tar.gz
.
File metadata
- Download URL: invrs_gym-1.4.2.tar.gz
- Upload date:
- Size: 61.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ef29973b09c4ad5b7ada5a5860fe2b5bd9cad0e60ffb136774eb26020cf4f542 |
|
MD5 | b24e90a0bb7d35f51159263bf8160433 |
|
BLAKE2b-256 | b2eeecdcce6ccbc76bd10d626401a9111bc8e60f6c3a5ac713c1b6be7178416d |
File details
Details for the file invrs_gym-1.4.2-py3-none-any.whl
.
File metadata
- Download URL: invrs_gym-1.4.2-py3-none-any.whl
- Upload date:
- Size: 72.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3ca536a6d92db68ba53c8295877bbe7c63551acdcd9473f47a02dad3ca81fc82 |
|
MD5 | 0a9ee7a9172a137155f2908a652a5b2b |
|
BLAKE2b-256 | 01b47daa5e38649a9526daaa15e140e064a0d6f48d15efd008125442c29ad8b6 |