Differentiable 3-D ray tracing for the micro-optics of optical interconnects
micro-VCSEL arrays · multicore fibre · single-mode lasers · high-speed photodiodes
Gradient-based design of a two-lens micro-relay that images a 25-µm-pitch micro-VCSEL array onto a 7-core multicore fibre (39-µm pitch). Worst channel 78.9 % → 99.1 %; the optimiser finds the telecentric solution by itself.
diffcoupler is a PyTorch library for designing and tolerancing the coupling optics of
optical links: laser / VCSEL → fibre, fibre → photodiode, emitter arrays → multicore fibre. Every
step — exact 3-D ray tracing through spheres, conics, aspheres and metasurfaces, multimode
(etendue) and single-mode (mode-overlap) coupling efficiency, crosstalk — is differentiable. So you
can optimise lens shapes and spacings by gradient descent and get exact alignment tolerances
from autograd Hessians.
Optical interconnects for AI clusters are scaling in density and lane rate at the same time:
- XPO — the Arista-led eXtra-dense Pluggable Optics MSA (March 2026) packs 12.8 Tb/s into a single liquid-cooled module: 64 lanes × 200 Gb/s on 8 × MPO-16, supporting SR/DR/FR/LR, ZR/ZR+ and "slow & wide" optics (Arista press release). Every lane has a laser→fibre and a fibre→detector coupling whose loss and alignment tolerance feed straight into the link budget and the assembly yield.
- micro-VCSEL arrays on multicore fibre are being pursued for power-efficient "slow & wide" AI scale-up links — e.g. 850-nm arrays with 25-µm-pitch emitters paired with a multicore-fibre assembly (ams OSRAM, ECOC 2026). This builds on 7-core graded-index MCF links with matching 2-D VCSEL / PD arrays (Lee et al., JLT 2012) and VCSEL arrays for MCF with 26-µm cores on a 39-µm pitch (Westbergh et al., IEEE PTL 2015).
- 200G per lane multimode links target 106 GBd PAM4, with 850-nm VCSELs already running at 100 GBd (Murty et al., OFC 2024). That calls for small, low-capacitance photodiodes, which turns the receive optic into an etendue-limited, high-NA design problem.
- DR/FR single-mode lanes couple DFB/EML lasers into SMF, a mode-overlap problem dominated by lens aberrations and beam ellipticity.
diffcoupler expresses all of these in one differentiable model: trace → couple → optimise →
tolerance.
| Ray tracing | Vectorised sequential 3-D tracing in float64 · planes, spheres & conics (closed form, ball-lens safe) · even aspheres (Newton + implicit differentiation: exact 1st and 2nd derivatives) · metasurface / diffractive phase plates · stops · decentre & tilt of every element · AR / Fresnel interfaces |
| Materials | Sellmeier / Cauchy models: fused silica, N-BK7, sapphire, silicon, PMMA, polycarbonate, index-matching gel, custom fits |
| Sources | Gaussian beams (elliptical, M², from waist / MFD / datasheet far-field FWHM) · multimode (micro-)VCSELs · fully-filled step- and graded-index MMF output · emitter arrays (hexagonal, square, linear, ring) |
| Receivers | Single-mode fibre · step-/graded-index MMF (local-NA acceptance) · multicore fibre with arbitrary core layout and clocking · photodiodes with angular acceptance + RC-bandwidth model |
| Coupling | Geometric multimode coupling & crosstalk matrices · pupil-based mode overlap (traced wavefront + ray-mapping Jacobian, non-paraxial) · analytic Gaussian coupling · etendue limits · wavefront maps |
| Design | Adam with per-variable scales & bounds · soft-min worst-channel objectives · differentiable (soft) apertures · paraxial conjugate solver |
| Tolerancing | Scans · Monte-Carlo yield · Hessians by double back-propagation → tolerance ellipsoids |
| Plots | Layouts, fibre facets, crosstalk matrices, wavefront maps, animations — with a colour-vision-deficiency-checked palette |
| # | Link | Starting point | Optimised |
|---|---|---|---|
| 1 | 850-nm micro-VCSEL array (25 µm pitch) → 7-core GI multicore fibre (39 µm pitch) | compact spherical relay: worst channel 78.9 % | 99.1 % worst channel, chief-ray angle 4.1° → 0.5° |
| 2 | fully-filled OM4 fibre → Ø16 µm photodiode (200G class) | best spherical block 82.8 %, textbook hyperbola 94.9 % | 100 %, tracking the etendue limit down to Ø8 µm |
| 3 | 1310-nm DFB laser (22° × 28° FWHM) → SMF-28 | sapphire ball lens 64.7 %, spherical singlet 38.9 % | 98.5 % (mode-shape limit 98.7 %) |
| 4 | 1060-nm single-mode VCSEL array → 7-core SM multicore fibre | outer cores 46.3 % | 99.9 % worst channel + exact tolerance analysis |
All numbers are from the example scripts in examples/, which regenerate every figure
on a laptop CPU in a few minutes each.
examples/01_microvcsel_to_mcf.py
A hexagonal 7-emitter micro-VCSEL array (850 nm, 4-µm emitters, 24° divergence) is imaged onto a 7-core graded-index MCF (26-µm cores, 39-µm pitch, NA 0.2) by two fused-silica aspheric micro-lenses. The relay must convert the pitch (|M| = 1.56) and keep every channel's cone within the local NA of a graded-index core. All 4 surfaces (curvature, conic, r⁴, r⁶) and 3 air gaps are optimised for the worst channel:
- per-channel coupling 78.9–86.3 % → 99.1–99.5 %, no stray light in neighbouring cores;
- the chief-ray angle at the outer cores drops from 4.1° to 0.5°: the optimiser discovers a telecentric relay without being told to;
- 1-dB alignment tolerances of the fibre: ±4.9 µm lateral, ±69 µm axial, ±10.8° rotation (clocking matters for MCF).
examples/02_fiber_to_photodiode.py
A moulded polycarbonate lens block (the unfolded path of a 45° TIR-mirror block, lenses on both faces, 250-µm-array-compatible apertures) images a fully-filled OM4 core (worst-case launch) onto a small, fast GaAs photodiode. Three lens families are optimised with the same optimiser:
- at Ø16 µm: spherical 82.8 %, textbook on-axis-perfect hyperbolas (k = −n²) 94.9 %, optimised aspheres 100 %. The textbook asphere loses because the fibre core is an extended source;
- the optimised design follows the etendue limit (46.0 % vs. 46.1 % at Ø8 µm; 98.9 % at Ø14 µm), which lets you pick a smaller photodiode with a higher RC bandwidth for the same coupling loss.
Single-mode coupling is computed with the exact pupil method: rays leave the laser waist over a grid of directions, and the traced wavefront plus the ray-mapping Jacobian define the image-space angular spectrum, which is overlapped with the fibre mode. For an elliptical DFB beam (1.3 × 1.0 µm waist):
- sapphire ball lens (Ø500 µm, gaps optimised): 64.7 % (−1.89 dB);
- best spherical N-BK7 singlet: 38.9 % (−4.10 dB), limited by spherical aberration;
- the same singlet with two optimised even-asphere faces: 98.5 % (−0.06 dB), essentially at the 98.7 % limit set by the elliptical-to-circular mode mismatch.
examples/04_sm_vcsel_to_sm_mcf_tolerance.py
A 26-µm-pitch 1060-nm single-mode VCSEL array (2-µm waist) is imaged onto a 7-core SM-MCF (40-µm pitch, MFD 6.2 µm). One magnification (|M| = 1.54) matches pitch and mode size; the relay is optimised with the mode-overlap objective for all channels (46.3 % → 99.9 %). The differentiable model then answers the manufacturing questions:
- exact Hessians of every channel w.r.t. 8 misalignments (fibre x/y/z/rotation, decentre of both lenses) in well under a second each: 1-dB tolerances ±1.4 µm (fibre x/y), ±25 µm (z), ±2.0° (rotation), ±0.93 µm / ±1.35 µm (lens decentres);
- the Hessian ellipses match brute-force scans. For a single outer core, a fibre rotation is exactly compensated by a shift (a zero-curvature direction), but not for all cores at once: the worst-channel tolerance region is the intersection of the per-core ellipses;
- Monte-Carlo assembly yield vs. placement accuracy, and an instant Hessian surrogate that tracks it.
Requires Python ≥ 3.9 and PyTorch ≥ 2.0 (CPU is plenty). Clone the repository, then:
pip install -e . # torch, numpy, matplotlib
pip install -e ".[dev]" # + pytest, to run the physics testsimport diffcoupler as dc
LAM = 1.31 # all lengths in µm
laser = dc.GaussianBeam(waist=(1.3, 1.0), wavelength=LAM) # elliptical DFB mode
fiber = dc.SingleModeFiber(mfd=9.2) # SMF-28
front = dc.EvenAsphere(radius=320.0, conic=-1.0, coeffs=[0.0, 0.0], norm_radius=250.0)
back = dc.EvenAsphere(radius=-320.0, conic=-1.0, coeffs=[0.0, 0.0], norm_radius=250.0)
lens = dc.Lens(front, back, thickness=450.0, material="N-BK7", aperture=260.0)
gap_in, gap_out = dc.Gap(300.0), dc.Gap(1500.0)
system = dc.System([gap_in, lens, gap_out])
system.set_magnification(LAM, gap_in, magnification=4.0) # paraxial mode matching
pupil = laser.pupil_rays(n=65)
eta = dc.mode_overlap(system.trace(pupil), fiber) # exact single-mode coupling
variables = [dc.Variable(s.c, scale=3e-5) for s in (front, back)]
variables += [dc.Variable(s.k, scale=0.02) for s in (front, back)]
variables += [dc.Variable(s.a, scale=0.3) for s in (front, back)]
variables += [dc.Variable(gap_in.thickness, scale=2.0, lower=100.0),
dc.Variable(gap_out.thickness, scale=10.0, lower=300.0)]
def loss():
e = dc.mode_overlap(system.trace(pupil, soft_aperture=1.0), fiber)
return -e.log(), {"coupling": e}
dc.optimize(loss, variables, steps=300, lr=1.0) # 21.9 % -> 97.8 % in ~15 s on a CPUTolerances come straight from autograd:
from diffcoupler.tolerance import hessian
f, grad, H = hessian(lambda: dc.mode_overlap(system.trace(pupil), fiber),
[(fiber.offset, 0), (fiber.offset, 1), (fiber.offset, 2)])Multimode links work the same way with dc.VCSEL, dc.FiberOutput, dc.GradedIndexFiber,
dc.MultiCoreFiber and dc.Photodiode (see the demos). Run the full example:
python examples/00_quickstart.py.
-
Exact intersections, exact derivatives. Conics are intersected in closed form; aspheres
by Newton's method followed by two differentiable Newton steps from the converged root. By the
implicit-function theorem this yields exact first and second derivatives with respect to every
shape, position and misalignment parameter (checked with
gradcheck/gradgradcheck). - Multimode coupling traces phase-space samples of the source and applies each receiver's spatial + angular acceptance (local NA for graded-index cores), with sigmoid edges while optimising. Etendue bounds are built in.
-
Single-mode coupling uses the pupil method:
$\eta = |\sum A\sqrt{T|J|},G,e^{ik_0W},\Delta u\Delta v|^2 / (P_{src}P_{mode})$ with the traced wavefront$W$ , the ray-mapping Jacobian$J$ and the fibre's angular spectrum$G$ . It is exact (and non-paraxial) for Gaussian optics. - Tolerancing uses the quadratic model given by the exact Hessian: tolerance ellipsoids from its eigen-decomposition, plus Monte-Carlo checks.
Details, equations and limitations: docs/physics.md.
pytest runs 35 physics tests (about 5 s on a CPU): material indices against reference data;
thick-lens and ball-lens focal lengths against the lensmaker's formulas (< 1e-7); a Cartesian oval
focusing to < 1e-9 µm with equal optical paths; Snell, TIR and Fresnel checks; gradcheck /
gradgradcheck through the tracer; mode overlap against analytic Gaussian coupling and against an
independent exact angular-spectrum integral (< 1e-6); η = 1 through an aberration-free relay; etendue
ratios for multimode coupling; Hessians against analytic curvatures; and the optimiser rediscovering
the aberration-free conic k = −1/n².
diffcoupler/ library
shapes.py planes, conics, even aspheres (exact intersections)
elements.py gaps, surfaces, lenses, ball lenses, stops, metasurface phase plates
system.py sequential system, paraxial helpers (focus, magnification solver)
materials.py Sellmeier / Cauchy catalogue
sources.py Gaussian beams, VCSELs, MMF output, emitter arrays
receivers.py SMF, step/graded-index MMF, multicore fibre, photodiodes (+ bandwidth model)
coupling.py geometric & mode-overlap coupling, wavefronts, Gaussian formulas, etendue
optim.py Adam with scales/bounds, soft-min
tolerance.py scans, Hessians, tolerance ellipses, Monte Carlo
plotting.py layouts, facets, matrices; style.py figure style & palette
examples/ the four demos + quick start (python examples/<name>.py [--quick])
tests/ physics validation suite
docs/ physics notes and figures
- Lens arrays with per-channel decentre errors; folded (45° TIR mirror) paths in native geometry
- Polarisation-resolved Fresnel losses and measured coating tables R(θ, λ)
- GRIN lenses, lensed fibres, and silicon-photonics edge / grating couplers via mode overlap
- Wavelength and temperature sweeps (CWDM4/LWDM lanes, VCSEL drift)
- Batched multi-design optimisation on GPU
If this is useful in your work, please cite it via CITATION.cff.





