<?xml-model href='http://www.tei-c.org/release/xml/tei/custom/schema/relaxng/tei_all.rng' schematypens='http://relaxng.org/ns/structure/1.0'?><TEI xmlns="http://www.tei-c.org/ns/1.0">
	<teiHeader>
		<fileDesc>
			<titleStmt><title level='a'>Transferable learning on analog hardware</title></titleStmt>
			<publicationStmt>
				<publisher></publisher>
				<date>07/14/2023</date>
			</publicationStmt>
			<sourceDesc>
				<bibl> 
					<idno type="par_id">10451558</idno>
					<idno type="doi">10.1126/sciadv.adh3436</idno>
					<title level='j'>Science Advances</title>
<idno>2375-2548</idno>
<biblScope unit="volume">9</biblScope>
<biblScope unit="issue">28</biblScope>					

					<author>Sri Krishna Vadlamani</author><author>Dirk Englund</author><author>Ryan Hamerly</author>
				</bibl>
			</sourceDesc>
		</fileDesc>
		<profileDesc>
			<abstract><ab><![CDATA[One-time AI training procedure enables exact model deployment onto arbitrary highly faulty analog hardware without retraining.]]></ab></abstract>
		</profileDesc>
	</teiHeader>
	<text><body xmlns="http://www.tei-c.org/ns/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink">
<div xmlns="http://www.tei-c.org/ns/1.0"><head>INTRODUCTION</head><p>Intense research over the past decade has demonstrated that neural networks (NNs) have a remarkable capacity to learn patterns and provide state-of-the-art performance in an astounding variety of artificial intelligence (AI) tasks <ref type="bibr">(1)</ref><ref type="bibr">(2)</ref><ref type="bibr">(3)</ref><ref type="bibr">(4)</ref>. Artificial NNs, such as feedforward, recurrent, and residual networks, are parameterized functions that map input vectors to output vectors by performing successive matrix multiplications and elementwise nonlinear operations. The entries of the matrices, commonly called weights, are tuned to fit the function model to the training data for the given task. Top-end NNs today are composed of billions of weights and require massive amounts of data for training. The time and energy costs of training and inference on models of this scale have become a major challenge and have triggered a surge of interest in hardware AI accelerators <ref type="bibr">(5,</ref><ref type="bibr">6)</ref>, both digital and analog.</p><p>Analog accelerators promise tremendous energy and time savings <ref type="bibr">(6,</ref><ref type="bibr">7)</ref>, but one still needs to answer the universal criticism of analog circuits-that they can be unreliable as general-purpose computers because of both static hardware errors caused by manufacturing variations and inherent noise in the signals being processed. These problems persist in the particular case of analog optical NNs (ONNs). For instance, the splitting ratio of a typical fabricated beamsplitter deviates by 1 to 2% from 50-50 <ref type="bibr">(8)</ref><ref type="bibr">(9)</ref><ref type="bibr">(10)</ref><ref type="bibr">(11)</ref><ref type="bibr">(12)</ref><ref type="bibr">(13)</ref><ref type="bibr">(14)</ref><ref type="bibr">(15)</ref><ref type="bibr">(16)</ref><ref type="bibr">(17)</ref><ref type="bibr">(18)</ref><ref type="bibr">(19)</ref>, which is sufficient to severely degrade the test accuracy of ONNs <ref type="bibr">(20)</ref> composed of interconnected Mach-Zehnder interferometers (MZIs) (Fig. <ref type="figure">1C</ref>). Hardware error correction techniques <ref type="bibr">(19,</ref><ref type="bibr">(21)</ref><ref type="bibr">(22)</ref><ref type="bibr">(23)</ref><ref type="bibr">(24)</ref><ref type="bibr">(25)</ref><ref type="bibr">(26)</ref><ref type="bibr">(27)</ref><ref type="bibr">(28)</ref><ref type="bibr">(29)</ref><ref type="bibr">(30)</ref><ref type="bibr">(31)</ref><ref type="bibr">(32)</ref><ref type="bibr">(33)</ref> applied to the hardware parameters provide substantial performance improvements but either require individual training/retraining of every ONN (Fig. <ref type="figure">1D</ref>) <ref type="bibr">(21)</ref><ref type="bibr">(22)</ref><ref type="bibr">(23)</ref><ref type="bibr">(24)</ref><ref type="bibr">(25)</ref><ref type="bibr">(26)</ref><ref type="bibr">(27)</ref><ref type="bibr">(28)</ref>, which is impractical in an edge setting with millions of devices, place stringent demands on component quality <ref type="bibr">(31)</ref>, or introduce hardware overhead <ref type="bibr">(19,</ref><ref type="bibr">32,</ref><ref type="bibr">33)</ref>. This is in sharp contrast to standard digital NNs (Fig. <ref type="figure">1A</ref>), where training is performed only once and the resultant model can be deployed to any number of devices with no modification (Fig. <ref type="figure">1B</ref>).</p><p>Here, we present a one-time error-aware software training technique that solves all three problems at once and brings analog NNs into the same league as digital NNs in terms of ease of model training and large-scale deployment. Our method outputs matrices that match the performance of trained ideal hardware and can be exactly transferred to any faulty ONN manufactured by a given process with no additional training or associated loss of performance (Fig. <ref type="figure">1F</ref>). Moreover, the procedure does not add extra hardware to the existing ONN. We show through numerical simulations that the method tolerates hardware errors up to five times larger than present-day fabrication errors.</p><p>Our method is a combination of two important ideas: the error correction scheme of Bandyopadhyay et al. <ref type="bibr">(31)</ref> and a form of engineering corner analysis <ref type="bibr">(34)</ref>. In more detail, it is known that splitter faults in an MZI shrink the set of unitary matrices that it can implement (Fig. <ref type="figure">1E</ref>) <ref type="bibr">(32)</ref>; we introduce and train "maximally error-tolerant" MZI mesh-based ONNs that have the most faults and smallest expressivity for a given error level and show that the resultant matrices both have very high performance and can be exactly transferred to other ONNs with equal or smaller errors. In other words, our one-time training procedure allows us to train only one highly faulty ONN and freely transfer the resulting model to any number of edge ONNs with their own individual faults (Fig. <ref type="figure">1F</ref>). Although we present results for feedforward MZI mesh-based ONNs, the training procedure is applicable to any MZI-based photonic circuit that permits implementation of the error correction scheme of <ref type="bibr">(31)</ref>. Our training procedure could, therefore, potentially find use in other applications of photonic circuits (31) such as quantum simulation <ref type="bibr">(14,</ref><ref type="bibr">(35)</ref><ref type="bibr">(36)</ref><ref type="bibr">(37)</ref><ref type="bibr">(38)</ref>, signal processing <ref type="bibr">(39)</ref><ref type="bibr">(40)</ref><ref type="bibr">(41)</ref><ref type="bibr">(42)</ref><ref type="bibr">(43)</ref>, and optimization <ref type="bibr">(44)</ref>.</p><p>Before we move on, it is important to clarify that the term "transferable learning" in the title of this paper is different from the "transfer learning" that is more common in the literature. Transfer learning is the paradigm in which models are first trained for a particular task and then fine-tuned to optimize performance on other distinct but related tasks. In the transferable learning of this paper, models are trained for a given task in such a way that they can be deployed onto any type of faulty hardware without any loss of performance on the same task-the same model for the same task is exactly "transferable" from one piece of faulty hardware to another. With this clarification in place, the rest of the paper is organized as follows: A summary of the optical hardware and the error correction scheme of Bandyopadhyay et al. <ref type="bibr">(31)</ref> is given in the "ONN structure and error correction" section to make the paper self-contained; maximally error-tolerant MZI meshes are introduced in the "Maximally error-tolerant MZI meshes" section; one-time training and numerical results are presented in the "Transferable learning through one-time training" section; results and applications are presented in Discussion followed by Materials and Methods.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>RESULTS</head></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>ONN structure and error correction</head><p>Any N &#215; N unitary matrix can be decomposed <ref type="bibr">(45,</ref><ref type="bibr">46)</ref> into a product of 2 &#215; 2 unitary matrices and an N &#215; N diagonal matrix D of complex phase shifts. The 2 &#215; 2 unitaries are implemented in hardware by MZIs, while separate phase shifters implement the diagonal matrix (see the circuit between the two nonlinear blocks in Fig. <ref type="figure">2A</ref>). Each MZI has two phase shifters, &#952; and &#981;. Individual MZIs are connected in a mesh topology that is consistent with the chosen N &#215; N unitary decomposition method. ONNs are constructed by interleaving individual N &#215; N meshes with elementwise nonlinear operations &#963;(&#8226;). The nonlinear function implemented by such a network <ref type="bibr">(31)</ref> is derived in section S1. Figure <ref type="figure">2A</ref> depicts an ONN layer composed of a 4 &#215; 4 rectangular Clements (46) mesh of MZIs.</p><p>One way to use ONNs is to train a digital model of an ideal ONN with perfect 50-50 beamsplitters and to program the resultant optimal phase shifts &#952; and &#981; of all the MZIs and the diagonal matrices D into the hardware for inference. However, as mentioned previously, beamsplitter errors arising from process variation cause a mismatch between the digital model and the model implemented by the hardware, leading to severe degradation of ONN testtime performance when ideal trained phase shifts are programmed into the faulty hardware with no modification <ref type="bibr">(20)</ref>. Correction of the trained phase shifts to account for hardware errors is, therefore, essential.</p><p>Published error correction procedures include global methods that adjust individual MZI phase angles using circuit-wide optimization <ref type="bibr">(21)</ref><ref type="bibr">(22)</ref><ref type="bibr">(23)</ref><ref type="bibr">(24)</ref><ref type="bibr">(25)</ref><ref type="bibr">(26)</ref><ref type="bibr">(27)</ref>, local methods (29-31) that do so using only devicelevel information, and hardware augmentation methods that introduce additional beamsplitters ("3-MZIs," discussed in the "Transferable learning through one-time training" section) <ref type="bibr">(32)</ref> or both beamsplitters and phase shifters <ref type="bibr">(19,</ref><ref type="bibr">33)</ref> into the system. Global methods can improve performance but can be impractical in edge computing settings where the same model needs to be operated on a large number of edge devices. Local methods apply readily to edge settings because they involve quick local adjustments, but they do not correct over a large splitting error range. Hardware augmentation methods such as the 3-MZI approach (32) correct over a very large error range but incur chip area costs due to the extra hardware. We present a one-time global training method here that readily applies to edge settings, has a large splitting error correction range, and involves no additional hardware overhead. Because our approach uses concepts derived in the local error correction scheme of (31), we provide a brief overview of their method next (sections S1 to S4 contain a detailed derivation of this method). The transfer function of an imperfect beamsplitter is</p><p>where &#945; is the "error angle" that captures the deviation from the ideal 50-50 ratio. Equation 1 reduces to the 50-50 case for &#945; = 0. Let the two error angles of a faulty MZI be denoted by &#945; and &#946;, respectively. Furthermore, let T(&#952;, &#981;) and T 0 (&#952;, &#981;, &#945;, &#946;) represent the transfer functions of an ideal and a faulty MZI, respectively. Then, Bandyopadhyay et al <ref type="bibr">(31)</ref> show that one can find an "error-corrected" set of phase shifts &#952; 0 , &#981; 0 , &#968; 1 , and &#968; 2 such that</p><p>if and only if the ideal phase shift &#952; satisfies the following "error correction condition"</p><p>In words, Eq. 2 says that an ideal MZI with phase shifts &#952; and &#981; can be implemented by programming &#952; 0 and &#981; 0 into an imperfect MZI and adding phase shifts &#968; 1 and &#968; 2 to the two output arms if and only if the imperfect MZI satisfies the error correction condition (Eq. 3). The phase shifts &#952; 0 and &#981; 0 can be computed and programmed either via explicit mesh calibration or through selfconfiguration <ref type="bibr">(29,</ref><ref type="bibr">(47)</ref><ref type="bibr">(48)</ref><ref type="bibr">(49)</ref><ref type="bibr">(50)</ref><ref type="bibr">(51)</ref> (sections S3 to S5 contain further details on error correction and self-configuration). Equation <ref type="formula">3</ref>plays a crucial role in the definition of "maximally error-tolerant" MZI meshes, which is the subject of the next section.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>Maximally error-tolerant MZI meshes</head><p>One approach to error-aware training is to calibrate the errors of the faulty hardware, construct a digital model of the system with the errors taken into account, train the digital model on the given task, and then port the resultant trained phase shifts back into the hardware. Alternatively, one could use the "physics-aware training" of ( <ref type="formula">52</ref>), which eliminates the need for explicit error calibration by collecting a training set of input-output pairs of the hardware and training a digital NN ("digital twin") on it; the digital twin and physical hardware are together used to obtain a good model for the given task. The in situ training of <ref type="bibr">(27,</ref><ref type="bibr">28,</ref><ref type="bibr">53)</ref>, where backpropagation is performed in the hardware itself to obtain mesh-specific matrices, is yet another approach. All these approaches involve training each physical chip with its own individual errors separately (Fig. <ref type="figure">1D</ref>), which is impractical in an edge computing setting with millions of edge devices. To solve this problem, we draw inspiration from corner analysis <ref type="bibr">(34)</ref> and introduce the concept of maximally error-tolerant meshes-this idea enables us to train only one special mesh ("one-time training") for a given error level &#949; and transfer the resultant matrices over exactly to any other mesh (having the same geometry) with errors less than &#949; without any additional mesh-specific training or loss in performance.</p><p>More precisely, let us say that a fabrication process P is guaranteed to produce MZIs with errors -&#949; &#8804; &#945;, &#946; &#8804; &#949; for some error level &#949; &#8805; 0. An MZI (not produced by process P) is maximally error-tolerant for error level &#949; if its errors satisfy &#945; = 2&#949;, &#946; = 0. A mesh is maximally error-tolerant if all its MZIs are maximally errortolerant.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>Understanding maximally error-tolerant meshes</head><p>To understand the utility of maximally error-tolerant meshes, we return to the error correction condition (Eq. 3). The derivation of the condition implies that any faulty MZI with errors &#945;, &#946; can be exactly emulated by an ideal MZI with a &#952; that satisfies Eq. 3. The transfer function of this ideal MZI can, in turn, be exactly implemented by any other faulty MZI whose errors &#945; 0 , &#946; 0 satisfy</p><p>This is because this condition, together with the true statement 2|&#945; + &#946;| &#8804; &#952; &#8804; &#960; -2|&#945; -&#946;|, automatically implies 2|&#945; 0 + &#946; 0 | &#8804; &#952; &#8804; &#960; -2|&#945; 0&#946; 0 |. A corollary of this result is that a trained maximally error-tolerant MZI at error level &#949; can be exactly emulated by any faulty MZI whose errors &#945;, &#946; satisfy |&#945; + &#946;| &#8804; 2&#949; and |&#945; -&#946;| &#8804; 2&#949;. This set includes all faulty MZIs with errors (&#945;, &#946;) that lie in the square bounded by the vertices (&#177;&#949;, &#177;&#949;), that is, all the MZIs produced by the fabrication process P under consideration.</p><p>In the sequel, we shall refer to the MZI with errors &#945;, &#946; as a "prototype" for all other MZIs whose errors &#945; 0 , &#946; 0 are smaller in the sense of Eq. 4. Figure <ref type="figure">2</ref> (B to E) depicts four example MZIs that will be treated as protoype MZIs in this discussion. Figure <ref type="figure">2</ref> (F to I) shows that prototype MZIs (dark green dot) can be emulated exactly by all MZIs in the &#945;, &#946; error phase space that satisfy Eq. 4 ("region of transferability," pale green rectangle) but not by MZIs that do not (red). The example prototype MZI errors are specifically chosen such that the prototype MZI of each panel ("panels" in this discussion refer to parts of Fig. <ref type="figure">2</ref>) lies within the region of transferability of the prototype MZI of each panel to its right. Therefore, the transfer matrix of panel E can be exactly implemented by all the MZIs to its left; the transferability of matrices between meshes is indicated by green dashed arrows. Only the prototype MZIs of panels C and E are maximally error tolerant. Figure <ref type="figure">2</ref> (J to M) depicts the range of ideal MZI &#952; phase shifts that are implementable by the prototype MZIs in panels B to E; the more faulty an MZI is, the less expressive it is.</p><p>The blue dashed squares [with corners (&#177;&#949;, &#177;&#949;)] inside the green rectangles of Fig. <ref type="figure">2</ref> (F to I) mark the largest error level &#949; ("transferability error level threshold") up to which the prototype MZI of that panel is transferable. Panels G and H have blue dashed squares of the same size. However, the maximally error-tolerant MZI of panel C explores a wider range of ideal &#952; phase shifts (panel K) than MZI D (phase shifts in panel L). Therefore, it is clear that, for any given error level &#949;, maximally error-tolerant MZIs apply less restrictions on the search space &#952; than any other prototype MZI.</p><p>The discussion above immediately suggests a one-time training procedure: train a maximally error-tolerant MZI mesh only once at a high enough error level &#949;, and one can then readily transfer the trained model exactly to any other MZI mesh that has errors smaller than &#949;. How the maximally error-tolerant meshes are trained is the subject of the next subsection. Once the training is done, the transfer of the trained phase shifts from the maximally error-tolerant mesh to a less faulty one may be performed in two steps: (i) translate the phase shifts of the more faulty mesh to an ideal mesh using the "inverse" of the error correction of (31) (see section S4) and (ii) translate the ideal phase shifts to the less faulty mesh using "vanilla" error correction <ref type="bibr">(31)</ref>. Both steps are guaranteed to work exactly. Alternatively, one could use the selfconfiguration of <ref type="bibr">(47,</ref><ref type="bibr">48)</ref> to directly program the matrix of the more faulty mesh into the less faulty one in a single step. The allimportant role played by the error correction condition (Eq. 3) in the above discussion implies that maximally error-tolerant meshes can only be constructed if the underlying mesh geometry permits implementation of the error correction scheme of <ref type="bibr">(31)</ref>. This includes all types of feedforward MZI mesh networks.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>Transferable learning through one-time training</head><p>One-time training simply consists of training maximally error-tolerant meshes for a given error level; the resulting matrices can then be transferred directly to any other arbitrary mesh at a lower error level with no additional retraining (hence the term "one-time"). We present two approaches to transferable learning of maximally errortolerant meshes: (i) a direct training approach where maximally error-tolerant meshes are trained separately for each given error level and (ii) a "transfer training" approach where the trained raw phase shifts of a maximally error-tolerant mesh at one error level are used as the starting point for training a maximally error-tolerant mesh at the next higher error level. Regardless of which method is chosen, the model obtained upon the completion of training can be freely deployed to any faulty network at a lower error level with no additional retraining. Our simulations (Fig. <ref type="figure">3B</ref>) used the neurophox <ref type="bibr">(30)</ref> and meshes (54) packages and were performed on an NVIDIA Tesla K40 GPU and the Engaging computing cluster at the Massachusetts Institute of Technology (MIT). Results from two-layer Clements mesh-based ONNs (Fig. <ref type="figure">3A</ref>) are presented in Fig. <ref type="figure">3B</ref> for the Modified National Institute of Standards and Technology (MNIST) (55) (digit), FashionMNIST (56) (clothing), and KMNIST (57) (Japanese character) classification tasks. The raw images of all datasets are low-pass-filtered (Fig. <ref type="figure">3A</ref>); the 256 and 400 slowest spatial frequencies (labeled "inputsize" in Fig. <ref type="figure">3B</ref>) are retained to enable detection of input size dependence of one-time training. Because the Fourier transform operation can be cast as a unitary operation on the one-dimensional unrolled image, the lowpass preprocessing can be done entirely optically on-chip through another MZI mesh.</p><p>Figure <ref type="figure">3B</ref> depicts three baselines: (i) the uncorrected case (red), where error-free meshes were trained and the resultant phase shifts were directly programmed, with no error correction, into faulty meshes; (ii) the corrected case (green), where the ideal trained phase shifts were first error-corrected according to <ref type="bibr">(31)</ref> and then fed into faulty meshes; and (iii) the 3-MZI case (orange). 3-MZIs are standard MZIs with an additional beamsplitter <ref type="bibr">(32)</ref>. The ideal trained matrices are fed into faulty 3-MZI meshes via self-configuration <ref type="bibr">(47)</ref>. The bold lines in Fig. <ref type="figure">3B</ref> are the medians over independent runs, while the paler sheath around the bold line represents the interquartile range (IQR). These baselines are compared against two varieties of transferable learning: one-time direct training and onetime transfer training.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>Transferable learning-Direct training of maximally errortolerant meshes</head><p>In this approach, the phase shifts of maximally error-tolerant meshes are trained from randomly initialized starting points &#952; and &#981; for each error percentage point between 0 and 35% error level; the results are plotted in Fig. <ref type="figure">3B</ref> in blue. In both the MNIST and FashionMNIST tasks, maximally error-tolerant mesh training matches or exceeds the performance of error correction (green) and the 3-MZI mesh (orange) up to 35% error level for both mesh sizes considered. There is a curious improvement in the performance that direct training achieves compared to the 3-MZI mesh on the Fash-ionMNIST task that one could try to attribute to a regularization caused by the fact that faulty meshes implement fewer unitaries than ideal meshes. That this is not a general phenomenon is immediately borne out by the substantially poorer test accuracy of direct training on KMNIST although it is still within 1% of the 3-MZI performance up to 10% error level. </p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>Transferable learning-Transfer training of maximally errortolerant meshes</head><p>In this approach, instead of training a maximally error-tolerant mesh for p% error level from randomly initialized phase shifts as in direct training, we use the raw, uncorrected phase shifts of a trained maximally error-tolerant mesh at (p -1)% error level as the starting point. Because model training does not begin from a random starting point, fewer epochs are needed to get to a good set of phase shifts at each higher error level. The model obtained upon completion of transfer training (say, upon reaching p = 35) can then be freely deployed onto arbitrarily faulty hardware at a lower error level with no additional retraining. The accuracy curves for transfer training are plotted in purple in Fig. <ref type="figure">3B</ref>. More information about curve smoothing is provided in Materials and Methods.</p><p>The results indicate that transfer training is nearly as good as direct training and the 3-MZI mesh on both the MNIST and Fash-ionMNIST tasks for both input sizes. On the other hand, the results for KMNIST, which is known to be a difficult dataset <ref type="bibr">(57)</ref>, are worse than even the error-corrected green curve. Transfer training was rerun for KMNIST with an increased number of epochs of training for every increase in error level; the substantially improved performance, which now matches direct training, is depicted in pink in Fig. <ref type="figure">4A</ref>.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>Unbalanced MZI losses</head><p>While the beamsplitter splitting errors considered so far preserve the unitarity of the mesh, unbalanced losses in the MZI arms can render the mesh transfer function nonunitary. We worked with KMNIST with input size of 256 to demonstrate that unbalanced losses have negligible influence on the test performance of ONNs.</p><p>Figure <ref type="figure">4B</ref> reports the evolution of test accuracies as random unbalanced MZI losses are progressively introduced into (i) a trained network composed of perfect 50-50 beamsplitters (green), (ii) a trained maximally error-tolerant network at 10% beamsplitter error level (blue), and (iii) a trained network with random beamsplitter errors at 10% error level (red). Because the networks in all three cases were not retrained to adapt to the introduced loss, the results in Fig. <ref type="figure">4B</ref> demonstrate that models trained on lossless meshes are robust in the presence of unbalanced losses in the actual hardware. The typical loss values for the phase shifters, beamsplitters, and component sizes were taken from <ref type="bibr">(31,</ref><ref type="bibr">47,</ref><ref type="bibr">58)</ref>; further details are provided in the "Unbalanced MZI loss data" section.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>DISCUSSION</head><p>ONNs are a leading analog accelerator platform for large-scale machine learning. However, their performance degrades markedly in the presence of static MZI beamsplitter errors <ref type="bibr">(20)</ref>. Existing error correction procedures are either impractical in large-scale edge settings, applicable over small beamsplitter error ranges, or involve additional hardware overhead. Here, we presented a one-time erroraware training technique for MZI-based ONNs that tackles all these problems. The method matches ideal-hardware performance even in the presence of large static hardware phase errors up to five times larger than present-day fabrication tolerance. Moreover, it is transferable and one time, that is, the training is performed only once and the resultant matrices can be programmed directly into any number of arbitrary highly faulty photonic NNs in an edge setting with no additional retraining. Furthermore, the method uses only standard MZIs and does not require additional hardware.</p><p>Our key contribution was the introduction of a principled combination of two important ideas: error correction and engineering corner analysis. More specifically, we introduced the concept of a "maximally error-tolerant network," one in which every MZI has errors &#945; = 2&#949;, &#946; = 0 for some &#949; &gt; 0, and showed that matrices obtained by training such a network yield excellent test performance over a very large range of &#949;. Furthermore, the trained matrices can be exactly ported, using self-configuration or error correction, onto other MZI networks (with the same underlying geometry) whose splitting error angles &#945;, &#946; all lie in the range [-&#949;, &#949;] with no additional training and no loss of performance associated with the transfer.</p><p>We presented two variants of transferable learning: (i) "direct training" of a maximally error-tolerant network from a randomly initialized starting point &#952;, &#981; for a given error level, and (ii) transfer training where one repeatedly transfers raw trained phase shifts of maximally error-tolerant networks at lower error levels to maximally error-tolerant networks at a slightly higher error level followed by a small amount of retraining. Numerical experimentation indicated that our method approached or achieved the large error tolerance of 3-MZI (32) networks on several benchmark tasks without incurring the additional hardware overhead of 3-MZIs. We also demonstrated that the typical unbalanced losses of interferometer chips have a negligible effect on the performance of our models, even at a high beamsplitter error level. While our study was based on feedforward MZI ONNs, the procedure can be applied to any MZI-based photonic circuit whose underlying geometry permits implementation of the error correction scheme of <ref type="bibr">(31)</ref>. More generally, we believe that the transferable learning method is applicable to any physical hardware, even nonoptical, that supports some type of error correction along with a kind of corner analysis that permits exact parameter transfer from a more faulty setup to a less faulty one.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>MATERIALS AND METHODS</head></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>Hyperparameters and preprocessing</head><p>Each of the three datasets contains 70,000 monochrome images of size 28 &#215; 28: 60,000 training images and 10,000 test images. Because it was previously observed that the higher spatial frequencies of MNIST images do not contain much information <ref type="bibr">(30)</ref>, the images were low-pass filtered by Fourier transforming them and selecting only a smaller square of Fourier components of side s centered at the origin. Incidentally, we observed that single-layer classifiers trained on the low-pass filtered Fourier components yielded higher test accuracy than those trained on the raw input images.</p><p>To probe the effectiveness of one-time training at different mesh sizes, we ran simulations for both s = 16 and s = 20, which correspond to 256 and 400 total input features (labeled inputsize in Fig. <ref type="figure">3B</ref>), respectively. Our NNs were two-layered, each layer was a Clements unitary mesh, and the electro-optic nonlinearity of <ref type="bibr">(59)</ref> was used between layers (Fig. <ref type="figure">3A</ref>). The first 10 outputs of the output layer were treated as the label predictors. The standard cross-entropy loss and the Adam optimizer were used.</p><p>A closer inspection of Eq. 3 reveals a natural upper limit on the error levels that our method can tackle. A maximally error-tolerant MZI emulates ideal MZIs whose phase shift &#952; lies in the range 4&#949; &#8804; &#952; &#8804; &#960; -4&#949;. The lower and upper limits of this range coincide at &#949; = &#960;/8 and the expressivity of a maximally error-tolerant MZI collapses to a single value of &#952;. For &#949; &gt; &#960;/8, there does not exist a single maximally error-tolerant MZI that transfers to all MZIs at that error level. Therefore, maximally error-tolerant MZIs are a meaningful concept only up to error level &#949; = &#960;/8 (35.36%); all our results are plotted up to that error level only.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>Baseline data</head><p>The performance of our transferable learning approach is compared against baseline data generated from the simulated transfer of the parameters of trained standard error-free mesh models onto faulty meshes with random beamsplitter error angles. While typical fabricated MZI-based circuits have random but spatially correlated beamsplitter error angles with a particular correlation distance, we use uncorrelated error angles in our simulations. This is because it was previously shown in <ref type="bibr">(48)</ref> that spatial inter-MZI error angle correlations do not contribute to the deviation of the mesh from the target matrix if the target matrix is drawn from the Haar distribution.</p><p>To generate the data for the three baselines (uncorrected, corrected, and 3-MZI), five ideal error-free meshes with independent Haar-random initial phase-shift conditions were trained for 50 epochs each. Next, for each ideal model and error level &#949; (which corresponds to 100 sin&#240;2&#603;&#222; 2 in percent, the quantity plotted on the x axis of Fig. <ref type="figure">3B</ref>), five faulty meshes were generated with MZI error angles chosen independently and uniformly randomly from the range [-&#949;, &#949;]. The step size in the error level was 1%. The ideal matrices were then transferred to these faulty meshes, by the process indicated for each baseline in the "Transferable learning through one-time training" section, and the test accuracies were recorded. This yields five values at each error level for each ideal model. Because there are five ideal trained meshes, we have 25 test accuracies for each error level from 1 to 35%. The medians of these numbers are plotted as bold lines in Fig. <ref type="figure">3B</ref>, while the IQR is represented as a paler sheath of the same color around the central bold line.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>Maximally error-tolerant meshes-Direct training data</head><p>In this approach, the phase shifts of maximally error-tolerant meshes are trained from randomly initialized starting points &#952;, &#981; for each error level. For each percentage point between 0 and 35% error level, five maximally error-tolerant meshes were trained independently for 50 epochs, and the median and IQR of these five values are plotted in Fig. <ref type="figure">3B</ref> in blue.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>Maximally error-tolerant meshes-Transfer training data</head><p>In this approach, a maximally error-tolerant mesh at p% error level is trained using the raw, uncorrected phase shifts of a trained maximally error-tolerant mesh at (p -1)% error level as the starting point. Because model training does not begin from a random starting point, fewer epochs are needed to get to a good set of phase shifts at the higher error level. In our implementation, we started out once again with the five ideal trained models that were previously used for the error correction and 3-MZI results. The uncorrected ideal model phase shifts are programmed into a maximally error-tolerant mesh at an error level of 1%, and this mesh is trained for two epochs. The resultant phase shifts are then fed directly into a maximally error-tolerant mesh at an error level of 2%, and two more epochs of training are performed. This training rate of two epochs for every percent increase in error level is maintained up to 35% error level, whereupon two more epochs of training are performed on a final mesh with 35.36% error level.</p><p>This procedure is performed with each of the five ideal trained models used as a starting point, yielding five models at each error level. The test accuracies of these models tend to be nonmonotonic, jagged functions of the error level, similar to the jagged blue curves of the direct trained models in Fig. <ref type="figure">3B</ref>. The fact that the higher error level meshes can be emulated exactly by lower error level meshes suggests that one can make jagged accuracy curves monotonic by assigning to each error level the performance of the best model at the same or higher error level. This "curve smoothing" is computationally prohibitive for direct training because 37 &#215; 50 = 1850 epochs are required to generate trained models for all error levels from 0 to 35.36%. Because it is likely that direct training will be applied to only a few error levels in a real-world setting, Fig. <ref type="figure">3B</ref> does not depict smoothed-out direct training results. On the other hand, because generating transfer trained models for the same error level range requires only 50 + 36 &#215; 2 = 122 epochs, we smooth out the accuracy curves for transfer training and plot the median and IQR in purple in Fig. <ref type="figure">3B</ref>.</p><p>For the improved five-epoch-per-step transfer training rerun on KMNIST, the number of epochs required (50 + 36 &#215; 5 = 230) is still smaller than the cost of direct training for all error levels (1850 epochs).</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>Unbalanced MZI loss data</head><p>Figure <ref type="figure">4B</ref>, which illustrates the effect of unbalanced MZI losses on network test accuracy, was generated using the component size and loss values reported in <ref type="bibr">(31,</ref><ref type="bibr">53,</ref><ref type="bibr">58)</ref>. Wilmart et al. <ref type="bibr">(58)</ref> report an average Silicon-On-Insulator (SOI) waveguide loss of 2.1 &#177; 0.25 dB/cm when a "typical" fabrication recipe is used, and an average loss of 0.1 &#177; 0.04 dB/cm when a "state-of-the-art" recipe with an added H 2 thermal annealing step is used. While Bandyopadhyay et al. <ref type="bibr">(31)</ref> mentions that the beamsplitters and titanium nitridebased thermal phase shifters are typically 100 and 400 &#956;m long, respectively, the experimental demo of (53) uses 200-&#956;m phase shifters. Figure <ref type="figure">4B</ref> presents results for meshes with 200-&#956;m-long thermal phase shifters, 100-&#956;m-long beamsplitters, and mean waveguide losses of 0, 0.525, 1.05, 1.575, and 2.1 dB/cm [i.e., 0, 25, 50, 75, and 100% of the mean 2.1 dB/cm loss observed in <ref type="bibr">(58)</ref>; the loss variance for each case was obtained by similarly scaling the reported variance in <ref type="bibr">(58)</ref>]. Per-MZI loss is assumed to follow a Gaussian distribution with the mean loss (on the x axis of Fig. <ref type="figure">4B</ref>) and the per-MZI loss variance (not shown) being calculated from the loss values and the component lengths. Ten random lossy networks with no beamsplitter errors were generated at each mean loss level (with the loss of each MZI being sampled independently from the Gaussian), and the raw phase shifts of the two-layer lossless perfect MZI networks (with 50-50 beamsplitters) that were trained in earlier sections were programmed directly into the lossy networks; the resultant test accuracies are reported in green in Fig. <ref type="figure">4B</ref>. The results of programming the raw phase shifts of trained lossless 10% maximally error-tolerant MZI networks into lossy 10% maximally error-tolerant MZI networks are shown in blue, while the results of self-configuration of the matrices of trained lossless 10% maximally errortolerant MZI networks into lossy 10% randomly faulty MZI networks are shown in red.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>Supplementary Materials</head><p>This PDF file includes: Section S1 to S5 Fig. <ref type="figure">S1</ref> scale nanophotonic circuits for neuromorphic computing" and "Netcast," administered by <ref type="bibr">MIT</ref> </p></div><note xmlns="http://www.tei-c.org/ns/1.0" place="foot" xml:id="foot_0"><p>Vadlamani et al., Sci. Adv. 9, eadh3436 (2023) 12 July 2023 1 of 9 Downloaded from https://www.science.org at University of Minnesota Twin Cities on August 31, 2023</p></note>
			<note xmlns="http://www.tei-c.org/ns/1.0" place="foot" xml:id="foot_1"><p>Vadlamani et al., Sci. Adv. 9, eadh3436 (2023) 12 July 2023 2 of 9 Downloaded from https://www.science.org at University of Minnesota Twin Cities on August 31, 2023</p></note>
			<note xmlns="http://www.tei-c.org/ns/1.0" place="foot" xml:id="foot_2"><p>Vadlamani et al., Sci. Adv. 9, eadh3436 (2023) 12 July 2023 3 of 9 Downloaded from https://www.science.org at University of Minnesota Twin Cities on August 31, 2023</p></note>
			<note xmlns="http://www.tei-c.org/ns/1.0" place="foot" xml:id="foot_3"><p>Vadlamani et al., Sci. Adv. 9, eadh3436 (2023) 12 July 2023 4 of 9 Downloaded from https://www.science.org at University of Minnesota Twin Cities on August 31, 2023</p></note>
			<note xmlns="http://www.tei-c.org/ns/1.0" place="foot" xml:id="foot_4"><p>Vadlamani et al., Sci. Adv. 9, eadh3436 (2023) 12 July 2023</p></note>
			<note xmlns="http://www.tei-c.org/ns/1.0" place="foot" xml:id="foot_5"><p>Downloaded from https://www.science.org at University of Minnesota Twin Cities onAugust 31, 2023   </p></note>
			<note xmlns="http://www.tei-c.org/ns/1.0" place="foot" xml:id="foot_6"><p>Vadlamani et al., Sci. Adv. 9, eadh3436 (2023) 12 July 2023 7 of 9 Downloaded from https://www.science.org at University of Minnesota Twin Cities on August 31, 2023</p></note>
			<note xmlns="http://www.tei-c.org/ns/1.0" place="foot" xml:id="foot_7"><p>Vadlamani et al., Sci. Adv. 9, eadh3436 (2023) 12 July 2023 9 of 9 Downloaded from https://www.science.org at University of Minnesota Twin Cities on August 31, 2023</p></note>
		</body>
		</text>
</TEI>
