## Abstract

Component errors limit the scaling of programmable coherent photonic circuits. These errors arise because the standard tunable photonic coupler—the Mach-Zehnder interferometer (MZI)—cannot be perfectly programmed to the cross state. Here, we introduce two modified circuit architectures that overcome this limitation: (1) a 3-splitter MZI mesh for generic errors, and (2) a broadband MZI+Crossing design for correlated errors. Because these designs allow for perfect realization of the cross state, the matrix fidelity no longer degrades with increased mesh size, allowing scaling to arbitrarily large meshes. The proposed architectures support progressive self-configuration, are more compact than previous MZI-doubling schemes, and do not require additional phase shifters. This removes a key limitation to the development of very-large-scale programmable photonic circuits.

## Introduction

Large-scale programmable photonic circuits are opening up radical new possibilities for optics. Of key importance in many devices is the universal multiport interferometer, which functions as an *N* × *N* reconfigurable feedforward linear circuit. This device, typically constructed with a compact mesh of Mach–Zehnder interferometers (MZIs, Fig. 1a, b)^{1,2}, is widely employed in applications ranging from spatially multiplexed optical communications to machine learning and quantum computing^{3,4,5,6,7}. Sadly, component errors (Fig. 1c) are a critical factor limiting the size of such circuits. Since the circuit depth of MZI meshes scales as *O*(*N*), the effect of errors grows with mesh size, meaning that, in practice, even modestly sized circuits cannot be programmed to high accuracy. Motivated by this challenge, a large body of recent work has focused on “correcting” hardware errors by global optimization^{8,9,10}, self-configuration^{11,12,13,14,15,16,17,18}, or local correction^{19,20}. For conventional MZI meshes, correction reduces errors by a quadratic factor^{16,19}; however, the effect of errors still grows with mesh size and poses a fundamental limit to the scaling of these circuits.

To overcome this limit, various alternative mesh architectures have been proposed. Non-compact structures such as binary trees avoid the extreme splitting-ratio requirements^{21,22}, but suffer from large chip area and the need for many crossings. A complementary approach is to stick to conventional geometries^{1,2}, but insert redundant MZIs to realize the full range of splitting ratios even in imperfect hardware^{23,24,25}. This solves the scaling problem, but at the cost of a 1.5–2× increase in the number of splitters and phase shifters. The resulting effects on chip area (particularly on emerging high-speed platforms where phase shifters have a large footprint^{26,27}), waveguide length (which affects insertion loss and latency^{28}), and electronic complexity (number of pads, traces, DACs/drivers, etc.) make this option unappealing.

In this paper, we propose two mesh architectures that achieve the same perfect scaling without significant added complexity: a 3-splitter MZI that corrects all hardware errors (Fig. 1d) and an MZI+crossing design that only corrects correlated errors, but has the added advantage of broader bandwidth (Fig. 1e). These designs take up significantly less chip area than the “perfect” redundant MZIs^{23,24}, and do not require additional phase shifters. Moreover, the proposed architectures support progressive self-configuration^{16,17}, allowing for error correction even when the hardware errors are unknown. This work will enable the development of freely scalable, broadband, and compact linear photonic circuits.

This paper is structured as follows: first we introduce the formalism of error correction in MZI meshes, focusing on the self-configuration approach. Splitting ratios are visualized as points on the Riemann sphere, where forbidden regions emerge as a result of hardware imperfections; these regions are centered at the poles (bar- and cross-state), where the probability density is at a maximum. To avoid this unfortunate coincidence, our architectures “rotate” the Riemann sphere to move the forbidden regions away from this peak, so that a larger fraction of MZIs are perfectly realized. Based on this concept, we introduce the 3-splitter MZI, which can correct arbitrary errors by rotating the forbidden regions to the equator. Using a benchmark optical neural network, we show that this modified MZI mesh is >3× more robust to hardware errors, enabling accurate inference in a regime where standard interferometric circuits struggle. Finally, we introduce the MZI+crossing, which flips the poles of the Riemann sphere. While this design is only robust against correlated errors, it has the added advantage of broader intrinsic bandwidth. For both architectures, we compare the matrix fidelity to the standard MZI to demonstrate the scaling advantage of both schemes.

## Results

### Error correction formalism

To correctly configure an MZI mesh in the presence of errors, one uses a nulling method based on physical measurements^{16,17}. Figure 2a illustrates the case of the triangular mesh^{1}, where the procedure is more straightforward. The transfer matrix for this system is a product of a phase screen *D* and a sequence of 2 × 2 unitaries *W*:

where *T*_{mn} is the *n*th MZI of the *m*th rising diagonal.

We program the mesh using a sequence of steps (Givens rotations), which build up *W* in order to diagonalize the “target” matrix *X* = *U**W*^{†}. For every step, we add one 2 × 2 unitary to *W*, performing the update *W* → *T*_{mn}*W*, which right-multiplies the target matrix \(X\to X{T}_{mn}^{{{{\dagger}}} }\) (Fig. 2b). The 2 × 2 unitary *T*_{mn} is chosen to null a specific matrix element *v* → 0 (shaded green in Fig. 2b), which is equivalent to the equation (indices *m*, *n* suppressed for notational simplicity):

This condition is visualized in Fig. 2c. In hardware, nulling of the (*i*, *j*) element of *X* is implemented by inputting the field \({w}_{j}^{*}\) (*j*th column of *W*^{†}) and adjusting the MZI parameters (*θ*, *ϕ*) to zero the output power at the *i*th port. If all nulling steps are performed exactly, the mesh will perfectly realize the target matrix *U* (see Methods and Supplementary Section 1 for details).

Mathematically, nulling involves setting the (complex-valued) splitting ratio \(s\equiv {T}_{11}/{T}_{12}=-{({T}_{22}/{T}_{21})}^{*}\) of the physical MZI to match the target value \(\hat{s}\equiv u/v\) required for diagonalization. In many cases, this is not possible, because the range of admissible splitting ratios \(\tan|\alpha+\beta|\le|s|\le \cot|\alpha -\beta|\) is restricted in the presence of hardware imperfections, namely the splitting-angle errors for the 50:50 couplers in a real MZI (*α*, *β* in Fig. 1c). Owing to these imperfections, forbidden regions emerge for small and large *s* where perfect nulling is impossible (Fig. 2d). It is also instructive to view this chart on the Riemann sphere, which shows that these forbidden regions are centered around the poles (Fig. 2b), highlighting the well-known fact that imperfect MZIs generally have finite extinction ratio and cannot realize a perfect cross (*s* = 0) or bar (*s* = *∞*) state.

If in a given nulling step \(\hat{s}\) falls within the forbidden region, nulling is imperfect, and an off-diagonal residual prevents perfect diagonalization of the matrix, leading to an “uncorrectable” error. This residual is proportional to \(d(s,\hat{s})\), the Euclidean distance on the Riemann sphere between the target ratio and the closest realizable *s*. The overall error is the quadrature sum of all such residuals.

For linear photonic circuits, two important fidelity figures of merit are (1) the coverage \({{{{{{{\mathcal{C}}}}}}}}\), i.e., the probability that a matrix is realized exactly, and (2) the normalized matrix error \({{{{{{{\mathcal{E}}}}}}}}=\langle|{{\Delta }}U{|}_{{{{{{{{\rm{rms}}}}}}}}}\rangle /\sqrt{N}\), a scaled Frobenius norm which is approximately equal to the average relative error for a given matrix element. \({{{{{{{\mathcal{C}}}}}}}}\) and \({{{{{{{\mathcal{E}}}}}}}}\) depend on the error model and the distribution of target matrices. Here, consistent with prior work^{16,17,19,29}, we sample target matrices randomly over the Haar measure^{30,31} and consider an uncorrelated Gaussian error model 〈*α*〉_{rms} = 〈*β*〉_{rms} = *σ*.

Analytic expressions for \({{{{{{{\mathcal{E}}}}}}}}\) and \({{{{{{{\mathcal{C}}}}}}}}\) are derived in the Methods, which we summarize here. If a mesh is straightforwardly programmed without taking any account of the imperfections (“uncorrected” error), the normalized error is \({{{{{{{{\mathcal{E}}}}}}}}}_{0}=\sqrt{2N}\sigma\)^{16,19}. The coverage \({{{{{{{\mathcal{C}}}}}}}}={e}^{-{N}^{3}{\sigma }^{2}/3}\) (Eq. (16)) decreases sufficiently fast that even moderately sized meshes have vanishingly small coverage, and error correction is generally imperfect. In this case, the residual “corrected” error \({{{{{{{{\mathcal{E}}}}}}}}}_{c}=(2/3)N{\sigma }^{2}\) (Eq. (19)) is the more relevant metric. Since \({{{{{{{{\mathcal{E}}}}}}}}}_{c}\propto {({{{{{{{{\mathcal{E}}}}}}}}}_{0})}^{2}\), self-configuration correction affords a quadratic suppression of errors, which is a significant advantage when errors are below a threshold. However, for sufficiently large meshes *N* ≳ 1/*σ*^{2}, error correction will be ineffective and the mesh cannot realize most matrices at high fidelity. Thus, even with error correction, hardware imperfections set a fundamental scaling limit for standard MZI meshes.

### Asymptotically perfect photonic circuits

The main challenge limiting error correction here is that the forbidden regions overlap with the peak of the probability distribution, which clusters tightly around the cross state *s* = 0 (Fig. 2e)^{29}. This clustering happens because light must propagate all the way down a mesh’s diagonals to realize generic unitaries; the forbidden regions disrupt this ballistic transport leading to clipping of off-diagonal matrix elements^{10}. Adding redundant components (MZI doubling) solves this problem by eliminating the forbidden regions altogether^{23,24}, but at the cost of added optical and electrical complexity. Here, we take the alternative approach of displacing the forbidden regions away from the cross state. This can be performed by placing a third splitter at the input of the MZI, as shown in Fig. 3a. The extra splitter performs a Möbius transformation \(s\to (s+i\tan \eta )/(1+is\tan \eta )\), which for a 50:50 splitting ratio (*η* = *π*/4) maps the bar and cross states to *s* = ±*i* (Fig. 3b). This can be visualized as a 90° rotation on the Riemann sphere, which pushes the forbidden regions to the equator, while the probability density is still concentrated at the poles (small errors *γ* in the third splitter perturb this rotation angle slightly, but this does not change the structure of the forbidden regions and has little effect on the error correction).

This “3-splitter MZI” (3-MZI) can therefore access the complete range of splitting-ratio magnitudes ∣*s*∣ ∈ [0, *∞*), and can thus function as a high-contrast optical switch^{24,32}. However, forbidden regions are still present for the 3-MZI, which implies that for some configurations, the relative phase of the splitter \(\arg (s)\) is constrained by hardware errors (unlike the MZI-doubled “perfect” couplers of refs. 23,24,25, which cure this defect with redundant phase shifters). However, from the distributions in Fig. 2e, for large meshes \(\hat{s}\) will fall into the 3-MZI’s forbidden regions only rarely. The normalized matrix error, calculated in the Methods (Eq. (22)), takes the following form:

In Fig. 3c, d, we numerically simulate self-configuration on imperfect meshes using the MESHES package (see Methods and Supplementary code); the realized \({{{{{{{{\mathcal{E}}}}}}}}}_{c}\) shows good agreement with Eq. (3). For large meshes *N* ≳ 64, the matrix error is approximately 1–2 orders of magnitude lower with the 3-MZI. Moreover, the 3-MZI exhibits more favorable error scaling, with the error remarkably decreasing with mesh size as \({{{{{{{{\mathcal{E}}}}}}}}}_{c}\propto \sqrt{\log (N)/N}\). This leads to asymptotically fault-tolerant hardware error correction: in the limit *N* → *∞*, matrices can be programmed perfectly.

This non-intuitive effect arises from the fact that, under the Haar measure, only a small fraction of MZIs have significant probability density near *s* = ±*i*, where the forbidden regions are centered^{29}. This probability decreases exponentially with the distance from the triangle’s base (see Methods for details). Therefore, although the mesh has *N*(*N* − 1)/2 MZIs, only *O*(*N*) contribute significantly to the matrix error under self-configuration. A naïve estimate assuming uncorrelated errors would give \(|{{\Delta }}U|\propto \sqrt{N}{\sigma }^{2}\), which would lead to a constant \({{{{{{{{\mathcal{E}}}}}}}}}_{c}\). However, during the self-configuration process, subsequent MZIs can partially correct for errors in earlier MZIs that cannot be properly configured; the end result is to reduce the overall error of each MZI by a factor proportional to \(\sqrt{\log (N)/N}\) (see Methods), yielding the result Eq. (3).

A second benefit to the 3-MZI is its higher threshold for perfect error correction. One obtains this threshold by computing the coverage \({{{{{{{\mathcal{C}}}}}}}}={e}^{-16N{\sigma }^{2}}\) (see Methods, Eq. (20)). This is much larger than the coverage of the regular MZI mesh, and the threshold scales as *σ*_{th} ∝ *N*^{−1/2}, in contrast to the *N*^{−3/2} dependence seen for the conventional mesh. Consequently, errors are perfectly correctable under a much broader range of circumstances, as shown in Fig. 3e.

### Error-resilient optical neural networks

To highlight the significance of this error reduction, consider as a concrete example deep neural network (DNN) inference on coherent optical hardware. A DNN is a sequence of layers, consisting of linear synaptic connections and nonlinear neuron activations. An emerging application of photonics seeks to use optical interference to accelerate this process, encoding neuron activations in coherent optical amplitudes, while a programmable MZI mesh implements the synaptic weights and activations are performed with an all-optical or electo-optic nonlinearity^{5}. Scaling remains the major challenge to constructing practical optical neural networks, as large mesh sizes (*N* > 100) are required to achieve a significant advantages over electronic hardware, and such large meshes are especially susceptible to fabrication errors. A recent numerical study showed that even with state-of-the-art process tolerances, hardware errors can significantly degrade DNN inference accuracy^{33}, a difficulty that has spurred investigations into alternatives to the MZI mesh, which all have their own limitations^{34,35,36,37}.

Figure 4a depicts a benchmark neural network. Here, 28 × 28 images from the MNIST digit dataset^{38} are preprocessed by a Fourier transform and cropped to a window of size \(\sqrt{N}\times \sqrt{N}\), which forms the input to a two-layer unitary DNN. The DNN can be implemented optically with rectangular MZI meshes for synaptic weighting^{2} and electro-optic nonlinearities for the activation (see refs. 17,39 for details). Models with inner-layer sizes *N* = 64 and *N* = 256 are pre-trained using the NEUROPHOX package^{40}, and inference accuracy is subsequently simulated on imperfect meshes with Gaussian splitter errors to calculate the classification accuracy.

This accuracy is plotted in Fig. 4b for three cases: straightforwardly programming an MZI mesh without error correction, with error correction, and with the modified 3-MZI architecture. Even for small device errors *σ* = 1–2%, which is considered state-of-the-art for directional couplers in highly controlled fabrication processes^{41}, hardware errors significantly degrade the model’s inference accuracy relative to its canonical value (*σ* = 0). For small *σ*, this is recovered using error correction^{17,19}. However, many broadband coupler designs^{42,43,44,45,46,47} trade bandwidth for fabrication sensitivity and are in practice very sensitive to process variations, meaning larger splitter errors *σ* ≳ 5% are common. In this moderate-error regime, error correction alone is not sufficient and the network shows reduced accuracy, a problem that becomes more pronounced as the size *N* increases. Moving to the 3-MZI architecture overcomes this limitation, enabling effectively error-free inference (relative to the canonical model) even out to very large splitter errors *σ* ≈ 10–15%, far beyond what is likely to be encountered in practice.

### Broadband mesh for correlated errors

For generic, uncorrelated component errors the 3-splitter MZI is well-suited. However, since the correlation lengths of process variations tend to be larger than a single MZI^{48}, errors are correlated in practice. This is especially true for broadband couplers based on multimode interference (MMI)^{42,43}, subwavelength gratings^{44,45}, and asymmetric designs^{46,47}, all of which are highly dependent on the device geometry, which can vary slightly from run to run. Moreover, even with perfect 50:50 couplers, the splitting ratios are still wavelength-dependent. Operating the mesh away from its design wavelength leads to correlated device errors, so sensitivity to these errors is closely tied to the operational bandwidth of the device.

Consider the case of a constant offset *μ* for all splitting ratios: *α* = *β* = *μ*. In a standard MZI, the bar-state forbidden region (around *s* = *∞*) disappears since ∣*α* − *β*∣ = 0, while the cross-state region (around *s* = 0, the peak of the probability distribution) remains in place (Fig. 2). This is consistent with the common observation that the extinction ratio in an MZI is much higher in the cross port than in the bar port. The optimal error reduction strategy, illustrated in Fig. 5a, was previously proposed in the context of broadband optical switching: place a waveguide crossing before the MZI^{49}. The added crossing performs the Möbius transformation *s* → 1/*s*, rotating the Riemann sphere by 180° to move the forbidden region to the minimum of the probability distribution (Fig. 5b, c).

As before, we can calculate the coverage and matrix error of this “MZI+crossing” (MZI+X) mesh by performing the nulling procedure on target unitaries, obtaining \({{{{{{{\mathcal{C}}}}}}}}\) from the probabilities that splitting ratios fall within the forbidden regions, and \({{{{{{{{\mathcal{E}}}}}}}}}_{c}\) from the residuals arising from imperfect diagonalization. In this case, there is only one forbidden region, centered at *s* = *∞*. The calculation is worked out in the Methods. For the normalized error, we find (Eq. (27)):

This is plotted in Fig. 6. Like the 3-MZI design, this metric scales as \({{{{{{{{\mathcal{E}}}}}}}}}_{c}\propto \sqrt{\log (N)/N}{\mu }^{2}\), in contrast to the trend \({{{{{{{{\mathcal{E}}}}}}}}}_{c}=(4/{3}^{3/2})N{\mu }^{2}\) calculated for the standard MZI under correlated errors. The coverage also increases (Eq. (25)), so that the threshold for perfect correction likewise scales as *μ*_{th} ∝ *N*^{–1/2}, in contrast to the *μ*_{th} ∝ *N*^{–3/2} dependence seen in the standard mesh.

Ultimately, the scalability of the MZI+X architecture is limited by differential errors ∣*α* − *β*∣ that arise from local fluctuations in waveguide dimensions. The effect of such errors is analyzed in Supplementary Section 2. For typical photonic process variations, ∣*α* − *β*∣ ≪ *μ* and differential errors are insignificant for mesh sizes up to at least *N* = 512.

As an added bonus, the MZI+X design also reduces the effect of errors in the absence of correction. To see how, we can make an analogy to Bloch-sphere rotations. The transfer matrix of a standard MZI is (up to a phase factor) the product of four rotations:

where \({R}_{k}(\eta )={e}^{i{\sigma }_{k}\eta }\) is a Pauli rotation and *σ*_{k} is a Pauli matrix. For the cross state (*θ* = 0), the errors *μ* add up constructively, while for the bar state (*θ* = *π*), they cancel out (the latter is a simple example of dynamical decoupling of spins using a pulse sequence). Most crossings in large meshes are close to the cross state, which leads to constructive addition of the errors in the standard MZI mesh. However, for the MZI+X, the input ports of each MZI are exchanged, so the physical MZIs are close to the bar state where the errors cancel out. The resulting uncorrected matrix error is (see Methods):

Correlated errors (both corrected and uncorrected) are important because they are tightly connected to the operational bandwidth of the mesh, a critical design parameter for machine learning schemes that require broadband operation, e.g., for parallel processing on wavelength-multiplexed data^{50,51,52,53}. All beamsplitters are dispersive, and this dispersion leads to a correlated wavelength-dependent splitter error, which can usually be expanded to first order *μ* ≈ (d*μ*/d*λ*)Δ*λ*. Two important wavelength-dependent figures of merit are (1) the tuning range, which refers to the range of *λ* over which the mesh can be programmed to a given accuracy, Fig. 7a, c, and (2) the bandwidth, which is related to the number of wavelength channels that can be (simultaneously) processed by the mesh, Fig. 7b, d. The tuning range is limited by the corrected error \({{{{{{{{\mathcal{E}}}}}}}}}_{c}\), while the bandwidth is limited by the uncorrected error \({{{{{{{{\mathcal{E}}}}}}}}}_{0}\), since a mesh cannot simultaneously error-correct at two different wavelengths. Since the MZI+X design reduces both \({{{{{{{{\mathcal{E}}}}}}}}}_{0}\) and \({{{{{{{{\mathcal{E}}}}}}}}}_{c}\), it leads to enhancements in both the bandwidth and tuning range. The enhancement factors scale as

and are listed for several mesh sizes in Table 1 (see Methods for details). As Fig. 7c, d illustrates, the MZI+X architecture enjoys a significantly larger tuning range, in addition to modestly greater bandwidth.

Real crossings have a small amount of nonzero crosstalk, quantified by the S-matrix element *S*_{21}; scattering into the forward-facing port leads to a perturbation \({R}_{x}(\frac{\pi }{2})\to {R}_{x}(\frac{\pi }{2}+\gamma )\) in the transfer matrix, where \(\gamma=1{0}^{-{S}_{21}[{{{{{{{\rm{dB}}}}}}}}]/20}\). This does not degrade the effectiveness of self-configuration, since the additional scattering angle merely rotates the Riemann sphere Fig. 5c by an additional angle *γ* ≪ 1, and the forbidden region is still far from *s* = 0. In-plane crossings in silicon can achieve sub-40 dB crosstalk suppression (*γ* < 0.01) with insertion losses well below 0.1 dB^{54,55,56,57,58}. Unlike directional couplers, crossings are inherently broadband; the insertion loss and crosstalk depend only very weakly on *λ*, so any crossing imperfections can be treated as (correctable) wavelength-independent errors that do not affect the bandwidth enhancements of the MZI+crossing scheme. In addition to the forward-scattered light, a 90° crossing will scatter light into the backward-facing port. Back-reflected light can be subsequently reflected in other crossings, leading to a spurious signal that interferes with the forward-propagating light. Provided that the phases of reflected beams are random, these add in quadrature: with amplitude *γ*^{2} and *O*(*N*^{2}) scattering paths, we expect this to induce an *O*(*N**γ*^{2}) error, which may be uncorrectable and set a limit on scaling. However, if this effect is small, gradient-based methods or iterative self-configuration may enable correction of these errors.

## Discussion

As photonic circuits grow larger, error tolerance becomes increasingly important. Many techniques exist to manage hardware errors, but all involve a tradeoff between accuracy and complexity. At opposite poles lie “zero-change” error correction, which has limited scalability^{16,17,19,59}, and “perfect” photonic circuits, which require a larger number of photonic and electronic components^{23,24}. This paper has introduced two designs for programmable circuits that strike a tradeoff between these extremes, as shown in Fig. 8 and Table 2, achieving performance that is almost as good as the perfect designs, but with less added complexity (see Supplementary Section 3 for details).

The main insight from this paper is that, by adding a single passive component (either a splitter or a waveguide crossing) to the MZI, we can recover behavior that is asymptotically perfect—that is, the average normalized matrix error *decreases* with size. Our design choices are motivated by the elegant theory of self-configuration by matrix diagonalization^{17}, where splitting ratios are set to successively zero the off-diagonal elements of the target unitary. By visualizing the MZI state on the Riemann sphere, we can intuitively understand the increased error robustness of our designs in terms of “rotating” the forbidden regions away from the peak probability density. This leads to a several-orders-of-magnitude reduction in post-correction errors compared to the standard MZI mesh. The ability to achieve near-perfect and freely scalable MZI meshes with less complexity than the MZI-doubled designs^{23,24} (especially with respect to the number of active components and pads) removes a major roadblock to the realization of very-large-scale nanophotonic systems.

An interesting direction for future work is to explore to what extent multiport interferometers can be made robust to imperfections in the absence of error correction. For example, previous studies of 3-MZI splitters have noted a wavelength-independent coupling ratio for certain parameter choices^{32}. Likewise, the near-cancellation of correlated errors in the MZI+crossing architecture explains the \(O(\sqrt{N/\log N})\) reduction in the uncorrected error, and corresponding increase in bandwidth. Further design modifications based on the theory of composite pulse sequences^{60,61,62} may allow this imperfect cancellation to be made exact, further improving the bandwidth (and multiplexing capabilities) of linear photonics.

## Methods

### Unitaries and the Riemann sphere

A generic 2 × 2 complex-valued matrix has eight degrees of freedom, and a 2 × 2 unitary has four. However, the space of 2 × 2 unitaries can be divided into equivalence classes based on the splitting ratio *s* = *T*_{11}/*T*_{12}. Specifically, any two unitaries are equivalent up to output phases, i.e., \(T={{{{{{{\rm{diag}}}}}}}}({e}^{i{\psi }_{1}},{e}^{i{\psi }_{2}})\hat{T}\), if and only if the splitting ratios are the same, \(s=\hat{s}\). As a complex number, *s* can be visualized on the Riemann sphere (Fig. 2d), where the mapping is performed by the stereographic projection *s* = (*x* + *i**y*)/(1 + *z*) (which inverts to *x* + *i**y* = 2*s*/(1 + ∣*s*∣^{2}), *z* = (1 + ∣*s*∣^{2})/(1 − ∣*s*∣^{2})).

Ordinarily, the distance between matrices is defined as the Frobenius (*L*_{2}) norm \(|{{\Delta }}U|={({\sum }_{mn}|{{\Delta }}{U}_{mn}{|}^{2})}^{1/2}\). However, since output phases are corrected in subsequent steps, the most relevant distance metric for a 2 × 2 block is the Frobenius norm modulo these phase shifts,

where \(d(s,\, \hat{s})=2|s-\hat{s}|/\sqrt{(|s{|}^{2}+1)(|\hat{s}{|}^{2}+1)}\) is the Euclidean distance between two points on the Riemann sphere.

A common parameterization is \(s={e}^{i\phi }\tan (\theta /2)\), which represents the splitting ratio of the standard MZI, Fig. 1b. On the Riemann sphere, (*θ*, *ϕ*) map to the standard polar coordinates, i.e., \(x=\sin (\theta )\cos (\phi )\), \(y=\sin (\theta )\sin (\phi )\), \(z=\cos (\theta )\).

### Coverage and matrix error derivation

The nulling method relies on successive zeroing of off-diagonal elements to diagonalize the matrix *X* (initialized to *U*). Each nulling step zeros a single element, increasing the size of the zeroed-out off-diagonal region. Nulling steps are performed in a particular order to ensure that zeroed-out elements remain zero after all subsequent steps^{1,2,17}. In a given step, if nulling cannot be achieved perfectly, the “zeroed-out” region of matrix *X* is left with a residual of magnitude:

where \(\hat{s}\) is the target splitting ratio, *s* is the closest physically realizable value, and \(d(s,\hat{s})\) is the Euclidean distance on the Riemann sphere, the same metric used in Eq. (8). The coverage and matrix error depend on (1) the distribution *P*(*s*) of target splitting ratios, a function of the distribution of target unitaries, and (2) the locations and sizes of the forbidden regions, a function of the specific mesh implementation (MZI, 3-MZI, MZI+X). For the Haar measure, *P*(*s*) depends on an MZI’s location in the mesh; for a given *T*_{mn} it takes the following form^{29}:

Here, the density is defined with respect to the area measure on the Riemann sphere

so that ∫*P*_{mn}(*s*)d*μ*(*s*) = 1. Note that, under Eq. (10), *P*_{mn} is uniform for the lowest row of crossings, and becomes increasingly concentrated as one approaches the triangle’s apex; as a result, the overall distribution is strongly biased towards the cross state for large meshes, as shown in Fig. 2e (the same distribution also holds for the rectangular mesh, up to a reordering of the MZIs).

The forbidden regions \({{{{{{{{\mathcal{F}}}}}}}}}_{\pm }\) are centered at opposite poles of the Riemann sphere

and have radii *R*_{±} = 2∣*α* ± *β*∣. In the case of small hardware errors, where *P*(*s*) ≈ *P*(*s*_{±}) inside each \({{{{{{{{\mathcal{F}}}}}}}}}_{\pm }\), the probability that \(\hat{s}\) falls inside the region is given by \(\pi {R}_{\pm }^{2}P({s}_{\pm })\). The coverage \({{{{{{{\mathcal{C}}}}}}}}\) is the probability that every \(\hat{s}\) avoids the forbidden regions, and is well approximated by

The normalized matrix error \({{{{{{{{\mathcal{E}}}}}}}}}_{c}=\langle|{{\Delta }}U{|}_{{{{{{{{\rm{rms}}}}}}}}}\rangle /\sqrt{N}\) is approximately the quadrature sum of the residuals accumulated during nulling:

Here, 〈…〉 refers to the ensemble average over both Haar-distributed target unitaries *U*^{30,31} and the distribution of hardware errors *α*, *β*. We calculate the mean residual 〈*r*^{2}〉 by averaging Eq. (9) over the distribution *P*(*s*). This is simplified in the case of small hardware errors, because the forbidden region is correspondingly small and where we can assume *P*(*s*) is approximately constant:

This residual depends on the quantity *q*_{mn} = 〈∣*u*∣^{2} + ∣*v*∣^{2}〉, where (*u*, *v*) are the highlighted in green in Fig. 2b. Following the Gaussian elimination procedure of a Haar matrix, this evaluates to *q*_{mn} = (*n* + 1)/(*N* + 1 − *m*).

A detailed description of the nulling algorithm, including a comparison to the local method^{19} and global optimization^{8,9,10} (which has a much longer convergence time), is presented in Supplementary Section 1.

### Gaussian errors: MZI and 3-MZI

For the uncorrelated Gaussian perturbation model with 〈*α*〉_{rms} = 〈*β*〉_{rms} = *σ*, the forbidden regions are (statistically) symmetric, with moments \(\langle {R}_{\pm }^{2}\rangle=8{\sigma }^{2}\) and \(\langle {R}_{\pm }^{4}\rangle=192{\sigma }^{4}\).

For the MZI mesh, the coverage expression Eq. (13) is dominated by the *s* = 0 term, where *P*_{mn}(0) = *n*/4*π*. Considering only this term, we calculate:

where we have replaced the discrete sum by an integral

which is valid in the limit of large *N*. Likewise, the top forbidden region dominates the matrix error, so we evaluate Eq. (15) including only the first term in the sum:

Converting the sum to an integral and substituting \(\langle {R}_{+}^{4}\rangle\), we find:

Now we redo the calculation for the 3-MZI. In this case, the forbidden regions are located at *s*_{±} = ± *i* and contribute equally to the problem. Following Eq. (13), the coverage is given by:

Applying Eq. (15), the mean residual left by crossing *T*_{mn} is:

The factors of two in Eqs. (20)–(26) arise because both forbidden regions contribute equally. This \(\langle {r}_{mn}^{2}\rangle\) is not slowly-varying with (*m*, *n*), so we cannot convert the sums to integrals. We first perform the summation over *n*, which converges rapidly due to the 1/2^{n+1} factor (approximating the upper bound to infinity because of the rapid convergence), followed by summation over *m*. We find the normalized error:

where the discrete sum is approximated using the relation \(\mathop{\sum }\nolimits_{n=1}^{N}{n}^{-1}\approx \log (N)+{\gamma }_{e}\), which defines the Euler–Mascheroni constant *γ*_{e} ≈ 0.5772.

### Correlated errors: MZI and MZI+X

Under a correlated error model, *α* = *β* = *μ*. In this case, there is only one forbidden region, which for the MZI is centered at *s*_{+} = 0, with *R*_{+} = 4*μ*. The coverage and matrix error for the standard MZI can then be calculated from Eqs. (16) and (19) with the appropriate substitutions for \(\langle {R}_{+}^{2}\rangle\), \(\langle {R}_{+}^{4}\rangle\):

Now consider the MZI+X. The additional crossing rotates the forbidden region to *s*_{+} → *∞*. Only the MZIs in the bottom row of the triangle (*n* = 1) contribute to the sums in Eqs. (13) and (14), because the probability distribution Eq. (10) vanishes at *s* = *∞* for the upper rows.

As before, we use the residual formula Eq. (15) to calculate the matrix error. In this case, there is only one forbidden region, centered at *s*_{+} = *∞*, with *R*_{+} = 4*μ*. Only the MZIs in the bottom row contribute to the sum, because the probability distribution Eq. (10) vanishes at *s* = *∞* for the upper rows. The coverage is:

With the mean residual given by

and \(\langle {r}_{mn}^{2}\rangle=0\) for *n* > 1, the matrix error evaluates to:

Now we consider the uncorrected matrix error. For the standard MZI mesh, this is \({{{{{{{{\mathcal{E}}}}}}}}}_{0}=2\sqrt{N}\mu\)^{17}. Using the transfer matrix of the standard MZI

to first order in (*α*, *β*), the norm of the matrix error is:

which is maximized when the MZI is in the cross state *θ* = 0. For the MZI+crossing (Fig. 5a), we find:

Up to irrelevant output phases, the effect of the crossing is to flip the relative sign of *α* and *β*, so the component errors appear anticorrelated. As a result, \(|{{\Delta }}T{|}_{{{{{{\rm{MZI+X}}}}}}}\propto \sin (\theta /2)\mu \), which is zero for the cross state. The actual error is found by adding the ∥Δ*T*_{mn}∥ in quadrature and averaging over the probability distribution \({P}_{mn}(\theta )=n\sin (\theta /2)\cos {(\theta /2)}^{2n-1}\) (equivalent to Eq. (10)):

For a wavelength-dependent splitter error *μ* ≈ (d*μ*/d*λ*)Δ*λ*, the tuning range and bandwidth can be calculated from the expressions for \({{{{{{{{\mathcal{E}}}}}}}}}_{c}\) (Eq. (27)) and \({{{{{{{{\mathcal{E}}}}}}}}}_{0}\) (Eq. (31)), respectively: the tuning range is the range over which \({{{{{{{{\mathcal{E}}}}}}}}}_{c}(\lambda )\, < \,{{{{{{{{\mathcal{E}}}}}}}}}_{\max }\), while the bandwidth is the range over which \({{{{{{{{\mathcal{E}}}}}}}}}_{0}(\lambda ) \, < \, {{{{{{{{\mathcal{E}}}}}}}}}_{\max }\):

From these expressions, we derive the enhancement factors reported in Eqs. (7) and Table 1.

### Neural network model

The optical neural network model is based on the architecture described in ref. 11. Input images are first Fourier transformed, and cropped to a \(\sqrt{N}\times \sqrt{N}\) window, where *N* is the DNN’s inner layer size. The signal from this window (*N* input neurons) passes through two optical layers, with unitary connectivity realized with rectangular meshes. The activation function at the inner layer is realized electro-optically: a fraction of each output field is tapped off and sent to a detector, whose photocurrent modulates the remaining output light^{28,39}, implementing the activation function:

where *α* is the power tap fraction, *g* is the modulator response, and *ϕ* is the phase at zero power. Here, we choose *α* = 0.1, *g* = *π*/20, and *ϕ* = *π*, so that *f*(*E*) approximates a leaky ReLU in the right power regime. Models of sizes *N* = 64 and *N* = 256 were trained using the NEUROPHOX package^{40}.

### Simulations and data analysis

All simulations were performed using the MESHES package, an open-source simulator for feedforward photonic circuits that can account for hardware imperfections^{63}. Figures 3, 4, 6, and 7 plot multiple instances (usually ≥100) per point; dots show medians while shaded regions show the interquartile range. Source code to produce the plots for this manuscript is provided in the Supplementary material.

## Data availability

All data from this paper can be generated using the MESHES package^{63} and source code files provided in the Supplementary material. Source Data are provided with this paper.

## Code availability

Source code files are provided in the Supplementary material.

## References

Reck, M., Zeilinger, A., Bernstein, H. J. & Bertani, P. Experimental realization of any discrete unitary operator.

*Phys. Rev. Lett.***73**, 58 (1994).Clements, W. R., Humphreys, P. C., Metcalf, B. J., Kolthammer, W. S. & Walmsley, I. A. Optimal design for universal multiport interferometers.

*Optica***3**, 1460–1465 (2016).Carolan, J. et al. Universal linear optics.

*Science***349**, 711–716 (2015).Zhong, H.-S. et al. Quantum computational advantage using photons.

*Science***370**, 1460–1463 (2020).Shen, Y. et al. Deep learning with coherent nanophotonic circuits.

*Nat. Photon.***11**, 441 (2017).Marpaung, D. et al. Integrated microwave photonics.

*Laser Photonics Rev.***7**, 506–538 (2013).Zhuang, L., Roeloffzen, C. G., Hoekman, M., Boller, K.-J. & Lowery, A. J. Programmable photonic signal processor chip for radiofrequency applications.

*Optica***2**, 854–859 (2015).Burgwal, R. et al. Using an imperfect photonic network to implement random unitaries.

*Opt. Express***25**, 28236–28245 (2017).Mower, J., Harris, N. C., Steinbrecher, G. R., Lahini, Y. & Englund, D. High-fidelity quantum state evolution in imperfect photonic integrated circuits.

*Phys. Rev. A***92**, 032322 (2015).Pai, S., Bartlett, B., Solgaard, O. & Miller, D. A. Matrix optimization on universal unitary photonic devices.

*Phys. Rev. Appl.***11**, 064044 (2019).Pai, S. et al. Parallel programming of an arbitrary feedforward photonic network.

*IEEE J. Sel. Top. Quantum Electron.***26**, 1–13 (2020).Hughes, T. W., Minkov, M., Shi, Y. & Fan, S. Training of photonic neural networks through in situ backpropagation and gradient measurement.

*Optica***5**, 864–871 (2018).Miller, D. A. Self-aligning universal beam coupler.

*Opt. Express***21**, 6360–6370 (2013).Miller, D. A. Self-configuring universal linear optical component.

*Photonics Res.***1**, 1–15 (2013).Miller, D. A. Setting up meshes of interferometers–reversed local light interference method.

*Opt. Express***25**, 29233–29248 (2017).Hamerly, R., Bandyopadhyay, S. & Englund, D. Stability of self-configuring large multiport interferometers.

*Phys. Rev. Appl.***18**, 024018 (2022).Hamerly, R., Bandyopadhyay, S. & Englund, D. Accurate self-configuration of rectangular multiport interferometers.

*Phys. Rev. Appl.***18**, 024019 (2022).Annoni, A. et al. Unscrambling light—automatically undoing strong mixing between modes.

*Light Sci. Appl.***6**, e17110 (2017).Bandyopadhyay, S., Hamerly, R. & Englund, D. Hardware error correction for programmable photonics.

*Optica***8**, 1247–1255 (2021).Kumar, S. P. et al. Mitigating linear optics imperfections via port allocation and compilation. Preprint at

*arXiv*:2103.03183 (2021).López-Pastor, V. J., Lundeen, J. S. & Marquardt, F. Arbitrary optical wave evolution with fourier transforms and phase masks.

*Opt. Express***29**, 38441–38450 (2021).Basani, J. R., Vadlamani, S. K., Bandyopadhyay, S., Englund, D. R. & Hamerly, R. A self-similar sine-cosine fractal architecture for multiport interferometers. Preprint at

*arXiv*:2209.03335 (2022).Miller, D. A. Perfect optics with imperfect components.

*Optica***2**, 747–750 (2015).Suzuki, K. et al. Ultra-high-extinction-ratio 2 × 2 silicon optical switch with variable splitter.

*Opt. Express***23**, 9086–9092 (2015).Wilkes, C. M. et al. 60 dB high-extinction auto-configured Mach-Zehnder interferometer.

*Opt. Lett.***41**, 5318–5321 (2016).Wu, R. et al. Fabrication of a multifunctional photonic integrated chip on lithium niobate on insulator using femtosecond laser-assisted chemomechanical polish.

*Opt. Lett.***44**, 4698–4701 (2019).Dong, M. et al. High-speed programmable photonic circuits in a cryogenically compatible, visible–near-infrared 200 mm CMOS architecture.

*Nat. Photon.***16**, 59–65 (2022).Bandyopadhyay, S. et al. Single chip photonic deep neural network with accelerated training. Preprint at

*arXiv*:2208.01623 (2022).Russell, N. J., Chakhmakhchyan, L., O’Brien, J. L. & Laing, A. Direct dialling of Haar random unitary matrices.

*N. J. Phys.***19**, 033007 (2017).Haar, A. Der massbegriff in der theorie der kontinuierlichen gruppen.

*Ann. Math.***34**, 147–169 (1933).Tung, W.-K.

*Group Theory in Physics: An Introduction to Symmetry Principles, Group Representations, and Special Functions in Classical and Quantum Physics*(World Scientific Publishing Company, 1985).Wang, M., Ribero, A., Xing, Y. & Bogaerts, W. Tolerant, broadband tunable 2 × 2 coupler circuit.

*Opt. Express***28**, 5555–5566 (2020).Fang, M. Y.-S., Manipatruni, S., Wierzynski, C., Khosrowshahi, A. & DeWeese, M. R. Design of optical neural networks with component imprecisions.

*Opt. Express***27**, 14009–14029 (2019).Tait, A. N. et al. Neuromorphic photonic networks using silicon photonic weight banks.

*Sci. Rep.***7**, 7430 (2017).Hamerly, R., Bernstein, L., Sludds, A., Soljačić, M. & Englund, D. Large-scale optical neural networks based on photoelectric multiplication.

*Phys. Rev. X***9**, 021032 (2019).Bernstein, L. et al. Single-shot optical neural network. Preprint at

*arXiv*:2205.09103 (2022).Chen, Z. et al. Deep learning with coherent VCSEL neural networks. Preprint at

*arXiv*:2207.05329 (2022).LeCun, Y., Bottou, L., Bengio, Y. & Haffner, P. Gradient-based learning applied to document recognition.

*Proc. IEEE***86**, 2278–2324 (1998).Williamson, I. A. et al. Reprogrammable electro-optic nonlinear activation functions for optical neural networks.

*IEEE J. Sel. Top. Quantum Electron.***26**, 1–12 (2019).Pai, S.

*Neurophox: A Simulation Framework for Unitary Neural Networks and Photonic Devices*. https://github.com/solgaardlab/neurophox (2020).Mikkelsen, J. C., Sacher, W. D. & Poon, J. K. Dimensional variation tolerant silicon-on-insulator directional couplers.

*Opt. Express***22**, 3145–3150 (2014).Soldano, L. B. & Pennings, E. C. Optical multi-mode interference devices based on self-imaging: principles and applications.

*J. Light. Technol.***13**, 615–627 (1995).Maese-Novo, A. et al. Wavelength independent multimode interference coupler.

*Opt. Express***21**, 7033–7040 (2013).Wang, Y. et al. Compact broadband directional couplers using subwavelength gratings.

*IEEE Photonics J.***8**, 1–8 (2016).Ye, C. & Dai, D. Ultra-compact broadband 2 × 2 3 dB power splitter using a subwavelength-grating-assisted asymmetric directional coupler.

*J. Light. Technol.***38**, 2370–2375 (2020).Morino, H., Maruyama, T. & Iiyama, K. Reduction of wavelength dependence of coupling characteristics using Si optical waveguide curved directional coupler.

*J. Light. Technol.***32**, 2188–2192 (2014).Lu, Z. et al. Broadband silicon photonic directional coupler using asymmetric-waveguide based phase control.

*Opt. Express***23**, 3795–3808 (2015).Bogaerts, W., Xing, Y. & Khan, U. Layout-aware variability analysis, yield prediction, and optimization in photonic integrated circuits.

*IEEE J. Sel. Top. Quantum Electron.***25**, 1–13 (2019).Suzuki, K. et al. Low-insertion-loss and power-efficient 32 × 32 silicon photonics switch with extremely high-

*δ*silica PLC connector.*J. Light. Technol.***37**, 116–122 (2018).Feldmann, J. et al. Parallel convolutional processing using an integrated photonic tensor core.

*Nature***589**, 52–58 (2021).Xu, X. et al. 11 tops photonic convolutional accelerator for optical neural networks.

*Nature***589**, 44–51 (2021).Sludds, A. et al. Delocalized photonic deep learning on the internet’s edge.

*Science***378**, 270–276 (2022).Davis, R., III, Chen, Z., Hamerly, R. & Englund, D. Frequency-encoded deep learning with speed-of-light dominated latency. Preprint at

*arXiv*:2207.06883 (2022).Fukazawa, T., Hirano, T., Ohno, F. & Baba, T. Low loss intersection of Si photonic wire waveguides.

*Jpn. J. Appl. Phys.***43**, 646 (2004).Chen, H. & Poon, A. W. Low-loss multimode-interference-based crossings for silicon wire waveguides.

*IEEE Photon. Technol. Lett.***18**, 2260–2262 (2006).Ma, Y. et al. Ultralow loss single layer submicron silicon waveguide crossing for SOI optical interconnect.

*Opt. Express***21**, 29374–29382 (2013).Dumais, P., Goodwill, D., Celo, D., Jiang, J. & Bernier, E. Three-mode synthesis of slab gaussian beam in ultra-low-loss in-plane nanophotonic silicon waveguide crossing. In

*2017 IEEE 14th International Conference on Group IV Photonics (GFP)*97–98 (IEEE, 2017).Wu, S., Mu, X., Cheng, L., Mao, S. & Fu, H. State-of-the-art and perspectives on silicon waveguide crossings: a review.

*Micromachines***11**, 326 (2020).Vadlamani, S. K., Englund, D. & Hamerly, R. Transferable learning on analog hardware. Preprint at

*arXiv*:2210.06632 (2022).Brown, K. R., Harrow, A. W. & Chuang, I. L. Arbitrarily accurate composite pulse sequences.

*Phys. Rev. A***70**, 052318 (2004).Bulmer, J., Jones, J. & Walmsley, I. Drive-noise tolerant optical switching inspired by composite pulses.

*Opt. Express***28**, 8646–8657 (2020).Little, B. E. & Murphy, T. Design rules for maximally flat wavelength-insensitive optical power dividers using Mach-Zehnder structures.

*IEEE Photon. Technol. Lett.***9**, 1607–1609 (1997).Hamerly, R.

*Meshes: Tools for Modeling Photonic Beamsplitter Mesh Networks*. https://github.com/QPG-MIT/meshes (2021).Bell, B. A. & Walmsley, I. A. Further compactifying linear optical unitaries.

*APL Photonics***6**, 070804 (2021).

## Acknowledgements

S.B. is supported by an NSF Graduate Research Fellowship. D.E. acknowledges funding from AFOSR (no. FA9550-20-1-0113, FA9550-16-1-0391). The authors thank Prof. David A. B. Miller and Dr Sunil Pai for helpful discussions.

## Author information

### Authors and Affiliations

### Contributions

S.B. and R.H. jointly conceived the idea. R.H. developed the theory, performed the simulations and data analysis, and wrote the manuscript. R.H., S.B., and D.E. contributed to discussion of the results.

### Corresponding author

## Ethics declarations

### Competing interests

R.H., S.B., and D.E. are inventors on patent applications No. 63/151,103 and 63/196,301 describing methods for self-configuration and error correction in linear photonic circuits.

## Peer review

### Peer review information

*Nature Communications* thanks Sinan Gündoğdu and the other anonymous reviewer(s) for their contribution to the peer review of this work. Peer review reports are available.

## Additional information

**Publisher’s note** Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

## Supplementary information

## Source data

## Rights and permissions

**Open Access** This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons license, and indicate if changes were made. The images or other third party material in this article are included in the article’s Creative Commons license, unless indicated otherwise in a credit line to the material. If material is not included in the article’s Creative Commons license and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this license, visit http://creativecommons.org/licenses/by/4.0/.

## About this article

### Cite this article

Hamerly, R., Bandyopadhyay, S. & Englund, D. Asymptotically fault-tolerant programmable photonics.
*Nat Commun* **13**, 6831 (2022). https://doi.org/10.1038/s41467-022-34308-3

Received:

Accepted:

Published:

DOI: https://doi.org/10.1038/s41467-022-34308-3

## Comments

By submitting a comment you agree to abide by our Terms and Community Guidelines. If you find something abusive or that does not comply with our terms or guidelines please flag it as inappropriate.