All-optical phase conjugation using diffractive wavefront processing

Optical phase conjugation (OPC) is a nonlinear technique used for counteracting wavefront distortions, with applications ranging from imaging to beam focusing. Here, we present a diffractive wavefront processor to approximate all-optical phase conjugation. Leveraging deep learning, a set of diffractive layers was optimized to all-optically process an arbitrary phase-aberrated input field, producing an output field with a phase distribution that is the conjugate of the input wave. We experimentally validated this wavefront processor by 3D-fabricating diffractive layers and performing OPC on phase distortions never seen during training. Employing terahertz radiation, our diffractive processor successfully performed OPC through a shallow volume that axially spans tens of wavelengths. We also created a diffractive phase-conjugate mirror by combining deep learning-optimized diffractive layers with a standard mirror. Given its compact, passive and multi-wavelength nature, this diffractive wavefront processor can be used for various applications, e.g., turbidity suppression and aberration correction across different spectral bands.


INTRODUCTION
Optical phase conjugation (OPC) has been used to counteract wavefront distortions by synthesizing a wave that is the complex conjugate of an impinging distorted wave, which can retrace the original propagation path and thereby "undo" the effects of wavefront-induced distortions 1 .Over half a century ago, a seminal work unveiled that OPC could counteract optical scattering using a photorefractive crystal as the phase-conjugate mirror 2 .Phase conjugation has also been demonstrated by degenerate four-wave mixing in absorbing materials 3,4 .This unique technique later fostered myriad applications including, but not limited to, laser beam focusing through scattering media [5][6][7][8][9][10][11][12][13][14][15][16] , imaging through turbid materials [17][18][19][20] , and improving the performance of optical communication systems [21][22][23][24][25] , among others.As one implementation of OPC, analog optical phase conjugation (AOPC) 5,6,9,15,17 harnesses nonlinear materials such as photorefractive materials to store the scattered field and produce its phase conjugate, presenting the merits of rapid and continuous phase modulation.Nevertheless, the predominant drawback of AOPC stems from its low conjugation reflectivity, leading to relatively weak energy in the timereversed beam.As an alternative, digital optical phase conjugation (DOPC) methods 8,10,12- 14,16,18,19,26 offer a different approach that uses a digital camera in an interferometric set-up to capture the optical wavefront information and digitally produce an OPC field, which can provide much higher conjugation reflectivity.However, DOPC is challenged with its intrinsically slower response, which results in playback latencies of tens of milliseconds and discrete modulation units on the order of several micrometers.In addition, the requirement of high-sensitivity interferometric/holographic imaging set-ups and light field modulation components such as spatial light modulators (SLMs) also bring considerable cost, system complexity and large footprint to existing DOPC solutions.Moreover, the digital recovery and processing of the optical phase information also add to the computational load of these DOPC systems.
Deep learning-based engineering of materials has recently emerged as a new approach for the inverse design of optical systems for various non-intuitive and nontrivial functions 27,28 .By leveraging multiple cascaded diffractive layers that are spatially engineered with wavelength-scale features, optimized using deep learning, a diffractive optical network (or a diffractive deep neural network, D 2 NN) [28][29][30][31][32][33][34][35][36][37][38][39][40] can be formed to perform universal linear transformations through the modulation of optical fields, and has been demonstrated for various applications including multispectral imaging 41 , quantitative phase imaging 34 , unidirectional imaging 42 , pulse shaping 43 , spectral filtering 44 , etc.The unique advantage of this diffraction-based visual computing platform lies in its ability to allow the thin diffractive material to directly interact with the input field wavefront and process the light field in situ, thereby significantly reducing or even eliminating the need for digital post-processing.Also, the processing is performed all-optically, using passive materials that do not consume power.
In this work, we introduce an all-optical phase conjugation framework based on deep learningengineered diffractive optical structures, which collectively perform phase conjugation on optical fields with unknown phase aberrations.The OPC task is completed at the speed of light propagation through a thin diffractive volume that axially spans ~84λ, where λ denotes the operating wavelength of the system.This OPC framework comprises multiple successively positioned dielectric diffractive layers, where each layer is spatially coded with hundreds of thousands of diffractive features, each engineered at a half-wavelength lateral pitch.Once optimized through deep learning in a computer, these diffractive layers are 3D fabricated to form a physical wavefront processor capable of processing a phase-distorted input wavefront that passes through its input aperture.This diffractive all-optical processing results in a phase profile at the output aperture, representing a conjugated version of the input phase distribution.Due to the use of passive optical modulation components in this diffractive processor, the OPC operation is solely driven by the intrinsic power of the input optical field, eliminating the need for any digital processing or other external power sources except for the illumination light.Moreover, since our diffractive OPC system accomplishes its task in an end-to-end manner as the field propagates through a very thin diffractive volume, it obviates the processing speed constraints commonly imposed by digital computation and light field modulation set-ups employed in traditional DOPC solutions, thus enabling ultra-high-speed phase conjugation operations at nanosecond or even picosecond levels, depending on the operation wavelength.
To demonstrate the efficacy of our framework, we first designed a transmissive diffractive OPC processor composed of 8 diffractive layers to perform phase conjugation within a short axial length of ~84λ.To train this diffractive processor design, we created a training dataset by randomly generating phase distributions composed of Zernike polynomials as the input field profiles, each paired with its phase-conjugated counterpart as the ground truth (desired profile) of the output phase.After the training, we conducted numerical blind testing using unseen input fields; when the trained diffractive processor was tested with phase aberrated input fields composed of 2 randomly selected Zernike polynomials, its output fields had a low phase mean absolute error (MAE) of <1.5%.Moreover, when testing using input phase profiles composed of 3 randomly selected Zernike polynomials, representing different types of phase distortions not included in the training inputs, the resulting phase MAE values still remained <1.5%, highlighting the diffractive processor's adeptness in processing unknown, complicated phase aberrated input wavefronts.Our numerical analyses revealed that, for a range of input phase contrast, our diffractive processor can be regarded as an approximation of the desired OPC function with minimal errors; however, as the input phase contrast and level of phase aberrations escalate, this approximation becomes less accurate.Furthermore, we numerically demonstrated the "time-reversal" effect of this diffractive OPC framework, which was achieved by symmetrically placing the same phase distortion plane before and after the transmissive diffractive OPC design.In our blind testing, the diffractive OPC processor successfully showed phase conjugation operation on a plane wave disturbed by an unknown, random phase perturbation, proving the utility of our diffractive OPC processor.
As an experimental proof-of-concept demonstration, we validated our diffractive OPC framework at the terahertz (THz) part of the spectrum.Leveraging 3D printing, we fabricated a 3-layer diffractive OPC processor, trained to perform OPC operation on phase aberrated input wavefronts at a wavelength of 0.75 mm.This fabricated diffractive processor was positioned centrally between two identical unknown phase perturbation planes that were also 3D-printed, and then tested with an input pinhole object to perform all-optical phase conjugation of aberrated spherical wavefronts.Although the diffractive OPC processor never saw the testing phase aberrations during its training, our experiments culminated in the successful reconstructions of sharply focused spots at the output, mirroring the original image of the pinhole object, experimentally verifying the success of our alloptical phase conjugation operation.
Delving deeper, we also explored combining the diffractive OPC processor with a reflective mirror to form a diffractive phase conjugate mirror.By placing a flat mirror behind the diffractive processor volume, the output wavefront from the diffractive processor folds back into the same diffractive layers (i.e., a double-pass configuration), ultimately reaching the same aperture used at the input.Our numerical results indicate that this diffractive phase conjugate mirror can be successfully trained to perform phase conjugation of unknown, randomly distorted wavefronts, with error levels almost identical to the transmissive OPC configuration.
The presented diffractive OPC platform holds design flexibility since it can function at different parts of the electromagnetic spectrum without retraining or optimizing its diffractive layers by simply scaling its features in proportion to the illumination wavelength.This feature makes our diffractive OPC framework highly desirable for correcting wavefront distortions at various parts of the spectrum where cost-effective and easy-to-implement phase conjugation solutions do not readily exist, such as the IR and THz bands.Moreover, since isotropic dielectric materials are used to fabricate these diffractive layers, the OPC function is independent of the polarization state of the incident light, which remains unchanged at the output of the diffractive OPC system.Combining these unique advantages, our diffractive OPC framework holds promise for various applications, including e.g.turbidity suppression and phase aberration correction, and can unlock different opportunities across diverse areas, including but not limited to biomedical imaging, microscopy, telescope systems and optical communication.

Design of a transmissive diffractive OPC processor
Figure 1 illustrates the general concept of a diffractive OPC processor that operates in transmission, i.e., with an input and an output aperture positioned at the different sides of the diffractive processor.As depicted in Fig. 1a, a diffractive OPC network composed of K successive diffractive layers (L1, …, LK) is positioned between the input and output apertures, with its primary function to perform optical phase conjugation of the aberrated fields within the input aperture and relay the resulting phase-conjugated fields into the output aperture.Each of these diffractive layers is coded with the same number of spatially engineered features, each with a lateral width of ~λ/2 and a trainable thickness that provides a full phase modulation covering 0 to 2π.The input aperture, diffractive layers and output aperture are connected to each other through free space.The intended functionality of this diffractive OPC framework is further elaborated on in Fig. 1b.An incident phase aberrated field  =   with a uniform amplitude and an unknown phase profile  passes through the input aperture.After being processed by the diffractive OPC processor, the resulting complex field is collected by the output aperture, represented as  = D 2 NN{ =   } .The objective function of our diffractive OPC processor is to ensure that, for any phase aberrated input field  =   , the diffractive output field  would exhibit a phase profile that closely approximates the phase-conjugated version of the input field, i.e.,  ≈  •  (GT) =  •  * =  •  − , where GT stands for ground truth, and  is a scalar constant that accounts for the output diffraction efficiency of the OPC processor.
As a proof-of-concept demonstration, we leveraged phase distributions formed by Zernike radial polynomials as our testbed to assess the phase conjugation capability of our diffractive OPC framework.Zernike radial polynomials are a set of continuous functions orthogonal over a unit circle 45 , which can be used to describe typical wavefront aberrations or deviations from an ideal wavefront in various optical systems.The mathematical representation of a Zernike radial polynomial is given by: , to create a variety of phase distributions.These phase distributions were used as the phase profiles of the input fields  =   within a circular input aperture, to be processed by our diffractive OPC framework.
To make our diffractive phase conjugation framework successful, it is imperative to train our diffractive model to accommodate a wide variety of phase profiles.With this in mind, we generated a set of 200,000 randomly selected Zernike polynomial phase distributions for training proposes.Each of these phase profiles was formulated by randomly selecting two from the first 28 Zernike polynomials and linearly combining them using random weight coefficients, which can be described as: where  1 ≠ 0 and  2 ≠ 0 are the weight coefficients of the polynomials adhering to the constraint that  1 +  We trained our diffractive OPC network with  = 8 successive diffractive layers using an operational wavelength of λ = 0.75 mm, as illustrated in Fig. 2a.During the training process, the thickness profiles of the diffractive layers were iteratively optimized via error-backpropagation and stochastic gradient descent techniques (see the Methods section for details).This optimization was targeted to minimize a specially devised loss function, which compares both the normalized amplitude and phase differences between the diffractive output fields  and their corresponding ground truth  (GT) .More details regarding the training loss function, numerical forward model and structural parameters of the diffractive OPC processor can be found in the Methods section.

Performance analysis of a transmissive diffractive OPC processor
After the deep learning-based optimization of the diffractive OPC processor, the resulting diffractive layer thickness profiles are visualized in Fig. 2b.To blindly test the OPC performance of our trained design, we first created a test set containing 10,000 pairs of input/target fields by following the same approach that we used for constructing the training set, except that each input/target phase profile in this test set has a phase contrast of  test = 1.Stated differently, the input fields in this test set can be represented as  =   and  =  1   1  1 +  2   2  2 , where  1 +  2 = ,  1 ≠ 0 and  2 ≠ 0, indicating that all the input/target fields have a dynamic phase range of [0, ].These input fields in the test set were also randomly generated to be different from those in the training set, ensuring that they were never seen before by our trained diffractive model.
Based on these test input fields, we obtained their corresponding output fields produced by the diffractive OPC network through numerical simulations.To evaluate these results, we first normalized these output complex fields with respect to their ground truth, eliminating the effect of their scaling mismatch caused by the output diffraction efficiency.Following that, we computed the MAE values for both the phase and amplitude components of the normalized output fields compared to the phase-conjugated ground truth, which we termed phase and amplitude MAEs, respectively.Based on this evaluation approach, we achieved an average phase MAE of 1.38 ± 0.12% across the entire test set.This suggests that the phase profiles of the output fields generated by our diffractive OPC network align closely with the target phase conjugated output distribution, manifesting only minimal discrepancies.On the other hand, the average amplitude MAE was quantified as 8.89 ± 1.91%, which also represents a relatively low error level, despite being larger compared to its phase counterpart.Figure 2c provides examples of diffractive output fields alongside their respective ground truth and error maps.These results illustrate that the diffractive output fields exhibit phase distributions almost identical to their ground truth.The amplitude of these output fields also presents a good uniformity across the output aperture of the diffractive OPC design.
In addition to these blind testing results, we created another test set of phase aberrated input fields with their phase profiles constituted by only a single, randomly selected Zernike polynomial term, i.e.,  =    .Such phase distributions, which represent a particular case of Eq. ( 2) with  1 or  2 = 0, can be used to describe distinct types of phase aberrations, including those frequently occurring in the pupil function of imaging systems such as coma and astigmatism 46 .We blindly tested our diffractive OPC network using 28 of such input fields (randomly generated), where each field corresponds to one of the first 28 Zernike polynomial terms -never seen by the diffractive model during the training process.The resulting diffractive output fields based on these input fields were then quantitatively compared with their phase-conjugated target fields, which yielded phase and amplitude MAE values of 1.71 ± 0.14% and 13.13 ± 2.31%, respectively, revealing a decent blind testing performance.This success is also confirmed by visualizing some diffractive output fields, as shown in Fig. 2d, which correspond to  2 −2 ,  3 −1 ,  4 0 and  3 −3 , representing coma, astigmatism, spherical aberration and trefoil, respectively 47 .Here, the output fields of the diffractive OPC processor present a successful phase conjugation operation performed on these typical phase aberrations, despite some imperfections in their amplitude components in regions with larger phase values, echoing our prior observations in Fig. 2c.
Next, we blindly tested our diffractive OPC model using input fields with their phase profiles constituted by a combination of 3 randomly selected Zernike polynomials, i.e., =  1   1  1 +  2   2  2 +  3   3  3 (i.e.,  1 +  2 +  3 =  , where  1 ≠ 0 ,  2 ≠ 0 and  3 ≠ 0 ).This test set demonstrates even more complicated phase structures than those seen during the training.Using randomly generated 10,000 input test fields, the same diffractive OPC processor design achieved phase and amplitude MAE values of 1.09 ± 0.06% and 8.39 ± 1.32%, respectively, further demonstrating its generalization success, performing all-optical phase-conjugation on various forms of randomly generated phase aberrations.The visualization of exemplary output fields is shown in Fig. 2e, underscoring our framework's robust external generalization capability for more complex phase conjugation tasks that were never represented in the training process.
In the analyses reported so far, our performance evaluation was conducted using phase-aberrated input fields with  test = 1.To delve deeper into the effects of varying  test on the performance of OPC, we extended our analysis across an array of  test values: [0.On the other hand, the diffractive outputs of the OPC processor almost identically mirror the desired phase-conjugated ground truth when the phase contrast is relatively small, e.g.,  test < 1.

Correction of phase aberration-induced wavefront distortions using a diffractive OPC processor
To shed more light on the capabilities of our diffractive OPC system in performing all-optical phase conjugation, we tested the time-reversal effect of OPC to counteract wavefront distortions caused by random unknown phase aberrations, as depicted in Fig. 4a.In this scenario, two phase perturbation planes that exhibit identical but randomly selected, unknown phase aberrations were positioned, before and after a diffractive OPC system.Upon encountering the first phase aberration plane, an incoming plane wave has its wavefront distorted in an unknown, random manner.Subsequently, after passing through the diffractive OPC system, the field of the outcoming wave is conjugated, which then impinges on the second phase aberration plane.Ideally, for a perfect OPC device, the phase-conjugated wavefront, after passing through the second phase aberration plane, should manifest as a uniform plane wavecleaned from any aberrations.To validate/test this behavior of our diffractive OPC design, we selected coma, astigmatism, spherical aberration and trefoil as different forms of random phase aberrations and employed the same diffractive OPC design shown in Fig. 2b, without any additional optimization.The results of this analysis are presented in Fig. 4b, which revealed a decent output phase profile in each case, cleaned from the aberrations of coma, astigmatism, spherical aberration and trefoil.We also contrasted these findings with the results obtained without the diffractive OPC processor between the two aberration planesthis resulted in non-uniform phase aberrations at the output plane, as expected.
To better comprehend these results from an application standpoint, we further focused these output fields through a diffraction-limited lens, the results of which are summarized in Fig. 4c.This aligns more closely with some of the existing practical applications where an OPC system is used to correct distorted wavefronts due to e.g., scattering media, enabling the conjugated wave to refocus through the same scattering medium again.The results reported in Fig. 4c clearly corroborate the diffractive OPC system's efficacy in achieving precise and sharp focusing.In contrast, in the absence of the diffractive OPC processor, apparent speckles can be found around the output focal point.These analyses further illustrate the efficacy of our diffractive OPC system, highlighting its potential applications for beam focusing through aberrations.

Experimental validation of a transmissive diffractive OPC network
Next, we sought to experimentally validate our diffractive OPC framework using a set-up based on monochromatic terahertz illumination.As illustrated in Fig. 5a, the objective here is to use a diffractive OPC processor to perform phase conjugation of a wavefront, which is emitted by a pinhole-like object and subsequently distorted by a random, unknown phase perturbation plane.
The resulting phase-conjugated wavefront (by the diffractive OPC processor) passes through another identical phase perturbation plane to be refocused onto a small pointif the OPC was successful.In this experimental configuration, we used a diffractive OPC design comprising K=3 phase-only dielectric diffractive layers (L1 -L3), positioned between two identical random, unknown phase perturbation planes with a phase contrast parameter of  test = 0.5.The input pinhole object is set as a square-shaped aperture with a size of 4.3λ, situated at a distance  before the first random phase perturbation plane.The wavefront exiting the diffractive OPC system is expected to focus on a spot of the same size as the input object at the same distance  after the second phase perturbation plane.The intensity distribution of this focusing spot is measured at the output plane, with its quality serving as the figure-of-merit of this experimental OPC validation.
The detailed structural parameters used for this experimental design are reported in Fig. 5a and the Methods section.
It is worth noting that, compared to the optical configuration used in the prior subsection (i.e., Fig. 4a), the experimental configuration in Fig. 5a possesses some differences.The main difference lies in that, in the experimental configuration, the optical field impinging onto the first phase perturbation plane has a spherical wavefront emitted by a pinhole, rather than a uniform plane wave as the one in Fig. 5a.Therefore, the complex field  that enters the diffractive OPC system's aperture after propagating through the first phase perturbation plane and the expected (ground truth) output complex field  (GT) that exits from the diffractive OPC system before the second phase perturbation plane can be written as: ,  (GT) (, ) =  * (, ) =  * (, ) −(,) (4).
Here in Eqs. ( 3) and (4),  denotes the phase profile of the randomly generated, unknown phase perturbation plane, and  represents the illumination field at the phase perturbation plane, emitted from the pinhole object.In our experimental set-up, due to the spherical wave characteristics of (, ), both its amplitude and phase distributions exhibit an increasingly rapid change from the center outwards to the edges.This leads to a significantly larger phase contrast  test in the actual input field.Therefore, if the diffractive OPC processor can successfully retrieve (at the output plane) the image of the input (pinhole) object, despite the presence of the randomly generated phase aberrations, it would indicate the successful implementation of the diffractive system's phase conjugation capability.
To train our experimental OPC design using K=3 diffractive layers, we generated a set of random phase perturbation planes and optimized our experimental diffractive OPC design through deep learning.The phase profiles of the resulting three diffractive layers are visualized in the left column of Fig. 5b.We fabricated these diffractive layers using 3D printing, with the photos of the fabricated layers presented in the right column of Fig. 5b.After assembling these diffractive layers, we employed a THz source ( = 0.75 mm) and detector to measure the resulting intensity distribution at the output plane.The schematic and photographs of the experimental set-up are presented in Figs.5c and d.
During the experiments, we tested our system using four different phase perturbation planes (also fabricated through 3D printing), which were never seen during the training ( test = 0.5). Figure 6 shows the experimental measurements, which successfully revealed a Gaussian-shaped circular spot pattern, closely aligning with the corresponding numerical simulation results.Furthermore, we also tested the system without placing the diffractive OPC network between the two phase perturbation planes, i.e., with only free space propagation.The resulting experimental images displayed only scattered patterns, starkly contrasting with the results achieved using the diffractive OPC processor.
In addition to these experimental results, we also performed an ablation study by constructing several baseline configurations and comparing their performances.As shown in Supplementary Fig. S1a, these baseline configurations include replacing the three-layer diffractive OPC processor with (1) a single-layer diffractive OPC processor, (2) a conventional thin lens, and (3) free space.
Here, we used the same phase perturbation planes as in the experiments, but adjusted the phase contrast to  test = 1, which sets a more challenging test.After the training, the resulting thickness profiles of the diffractive layers for these baseline configurations are provided in Supplementary Fig. S1b, and their test results are compared in Supplementary Fig. S2.From these comparative analyses, it can be found that the single-lens and the single-diffractive-layer systems produce similar results: while they can both generate a spot at the output plane, the positions of the spots do not appear accurately at the center, revealing beam focusing artifacts, and these spots are accompanied by various noise patterns at the output plane.The results of the K=3 diffractive OPC system, on the other hand, provide superior results to both of these baseline systems, as shown in Supplementary Fig. S2.These observations also align with the architectural depth advantages of diffractive visual processors, demonstrated for various applications by achieving better approximation accuracy for a given task when the diffractive degrees of freedom are distributed across a deeper architecture 27,31,32,34,48 .

Output power efficiency of diffractive OPC designs
In traditional AOPC solutions, the output power of the phase-conjugated beam could be weak due to the nonlinear optical processes involved in AOPC systems, often leading to a low power efficiency of <1%.While the digital OPC methods can provide considerable power due to incorporating active illumination and modulation in their playback process, they present other limitations, including increased system complexity and reduced operation speed.For our diffractive OPC framework, its power efficiency is directly associated with the output diffraction efficiency exhibited by the diffractive volume.Based on theoretical evidence and numerical studies presented in earlier works 32,48,49 , axially deeper diffractive processor architectures were proven advantageous in terms of their transformation accuracy and output diffraction efficiency.
Here, we analyzed the impact of the number of trainable diffractive layers (K) on the OPC performance quantified by the output phase MAE.Taking our design shown in Fig. 2b with K = 8 as the baseline design for this analysis, we trained its counterparts with different numbers of diffractive layers, e.g., K = 4, 6 and 10, by maintaining the other structural parameters identical to the baseline design, also using the same training dataset.Figure 7a reports these designs' resulting output phase MAE values as a function of K.It is evident that as K increases the phase conjugation errors of the diffractive output fields decrease; for example, the phase MAE values at K = 4 and 10 are reported as 2.37 ± 0.37% and 1.55 ± 0.21%, respectively.These findings are also confirmed through the exemplary visualization results shown in Fig. 7b, where the output phase profiles from the models with K = 8 and 10 present much better similarity to their ground truth when compared to the models with smaller K. Furthermore, the output diffraction efficiencies of these OPC designs also present an increasing trend as more diffractive layers are used.For instance, the model with K = 4 yields an output diffraction efficiency of 13.8 ± 1.2%, and this efficiency increases to 24.4 ± 1.2% when K = 10 is used, marking an efficiency increase of 10.6%.These diffraction efficiency metrics underscore that a deeper architecture for our diffractive processors achieves both better OPC performance and better output power efficiency by exploiting the larger degrees of freedom and the depth advantage.
Although the diffractive OPC designs shown in Fig. 7 all present output diffraction efficiencies of >13-25%, OPC systems that are even more power-efficient might be sought for various realworld applications, involving e.g., low signal-to-noise ratio image sensors.To address this need, one can introduce an additional diffraction efficiency-related loss term 33,34,41,43,49,50 to the training loss function, aiming to balance the tradeoff between the OPC performance and the diffraction efficiency of the diffractive processor (see the Methods for details).This strategy was already employed in the experimental design shown in Fig. 5b to enhance the diffraction efficiency of the output signals.In Fig. 8, we present an in-depth quantitative exploration of this tradeoff relationship between the OPC performance and the output diffraction efficiency.For this analysis, we revisited the two designs with K = 4 and 8 shown in Fig. 7; these designs respectively exhibit diffraction efficiencies of 13.8 ± 1.2% and 20.2 ± 0.9%, with phase MAE values of 2.37 ± 0.37% and 1.71 ± 0.21%, and amplitude MAE values of 10.80 ± 2.13% and 10.80 ± 2.84%.Keeping the structural parameters identical as before and utilizing the same training/testing dataset, we retrained these diffractive OPC designs (from scratch) by applying varying degrees of diffraction efficiency penalty to the training loss functions, resulting in new designs with enhanced output diffraction efficiencies.Figure 8a depicts the phase and amplitude MAE values of these new designs in relation to their output diffraction efficiencies.These results reveal that, compared to the original K=4 design shown in Fig. 7, the newly trained diffractive designs achieved a ~6-fold increase in their output diffraction efficiencies, reaching up to 85.9 ± 1.7%.This improvement comes with a modest sacrifice in their phase conjugation performance, with phase MAE values reaching up to 3.23 ± 0.38%.Similarly, compared to the original K = 8 design shown in Fig. 7, these new designs subjected to the diffraction efficiency penalty showcased a further improved diffraction efficiency of up to 92.1 ± 1.5%, with only marginal surges in the phase MAE values that reach up to 2.26 ± 0.32%.
In these analyses, we also observed an intriguing phenomenon: as the diffraction efficiency increases, there is a slight decrease in the amplitude MAE values of the diffractive OPC designs.These results suggest that a stronger diffraction efficiency-related penalty term results in a greater portion of the lower spatial frequency modes being directed into the output aperture, leading to a more uniform output field amplitude distribution, which lowers the amplitude MAE values.Figure 8b offers a visual representation of these designs' diffractive output fields, further corroborating our findings.Collectively, these results suggest that diffractive OPC processors can provide a favorable balance between their phase conjugation performance and output diffraction efficiency, which can be improved as desired by using an appropriate training loss function.

Diffractive phase-conjugate mirror design
In our results and analyses presented so far, we utilized diffractive OPC processors in a transmission geometry.While the transmissive structure we illustrated can be retrofitted into a reflective OPC configuration, this would complicate the system with additional optical components such as beam splitters and image projection systems.To create a simpler solution for designing a phase-conjugate mirror, we merged a diffractive OPC system with an ordinary reflective mirror, which creates a double-pass configuration through the same diffractive layers to all-optically perform OPC in reflection mode.As illustrated in Fig. 9a Following this optical configuration, we numerically modeled a diffractive phase-conjugate mirror that shares the same set of design parameters as the previous transmissive OPC design presented in Fig. 2a.Utilizing the same dataset used by the analysis reported in Fig. 2, we trained and validated our diffractive model, with the resulting phase profiles of the diffractive layers shown in Fig. 9b.Our numerical simulations achieved average phase and amplitude MAE values across different test sets: for input phase profiles constituted by two randomly selected Zernike polynomials, the phase and amplitude MAE values were 0.98 ± 0.54% and 12.12 ± 3.65%, respectively; for those input fields using a single randomly selected Zernike polynomial, the MAE values were 1.44 ± 0.20% and 15.91 ± 2.04%, respectively; and for those featuring three randomly selected Zernike polynomials, the MAE values were 0.80 ± 0.39% and 10.58 ± 2.90%, respectively.Moreover, the visual illustrations reported in Fig. 9c-e revealed that the diffractive output fields present a very good agreement with their corresponding ground truth phase profiles, confirming the success of the OPC operation.The amplitude distributions of the reflected fields also generally retain uniformity with minor errors that stand at a similar level as the previous transmissive OPC designs.Overall, these results affirm the feasibility of designing a diffractive OPC processor coupled with an ordinary mirror to create a reflective phase-conjugate mirror, which might find various applications in e.g., turbidity suppression and atmospheric aberration correction, among many others.

DISCUSSIONS
In the practical implementations of our diffractive OPC processors, mechanical misalignment between different elements could constitute a notable challenge to their phase conjugation performance, as they can cause the optical waves to be modulated by the diffractive layers in an undesired way, leading to results deviating from their designed performance.To address this challenge, a "vaccination" strategy can be applied during the training process by modeling these misalignment errors as random noise into the numerical forward model of the system 33,36,51 .For instance, we can model 3D random displacements of the diffractive layers (in x, y and z) using random variables, changing from iteration to iteration during the training process, which were shown (both numerically and experimentally 33,36,51 ) to provide substantial resilience against such random displacements at a tolerable cost of performance loss.Beyond mechanical misalignments, this vaccination strategy can also be extended to counteract other types of potential errors, such as fabrication imperfections in diffractive layers, inaccuracies in material dispersion characterization and detection noise, thereby enhancing the practical robustness of the diffractive OPC system.
The results and analyses of this manuscript have successfully demonstrated diffractive OPC processors that can all-optically perform phase conjugation of input complex fields with arbitrary unknown phase distributions, without the need for any digital computation, image acquisition or active beam modulation.Through simulations, the accuracy of our diffractive OPC operation was analyzed, revealing the empirical relationship between the phase conjugation accuracy and the phase contrast of the input fields.Furthermore, we experimentally validated this concept at the terahertz part of the spectrum by 3D fabricating a diffractive OPC processor, which successfully processed randomly generated phase-aberrated input fields.The presented diffractive OPC processor designs can be scaled (expanded/shrunk) to extend their operation to other parts of the electromagnetic spectrum, including the visible and IR bands.Such diffractive OPC processors operating at shorter wavelengths can be fabricated using appropriate nano-/micro-fabrication methods, such as two-photon polymerization-based 3D fabrication [52][53][54] , enabling the development of compact, high-speed OPC solutions that can be closely integrated with imaging systems.

Optical forward model of the diffractive OPC processors
To model a diffractive OPC processor, its diffractive layers are treated as thin planar elements that modulate the complex field of the incident coherent light.For the  th diffractive feature of the  th layer positioned at the spatial coordinates (  ,   ,   ) , the complex transmission coefficient (  ,   ,   ) can be represented as a function of its material thickness ℎ   .This relationship can be mathematically expressed as: Here,  and  correspond to the refractive index and extinction coefficient of the selected dielectric material at , corresponding to the real and imaginary components of the complex refractive index  ̃, i.e.,  ̃=  +  .For the diffractive OPC design used for experimental validation,  and  were taken as 1.7 and 0.017, respectively.These values were measured using a terahertz spectroscopy system 38 .In the other diffractive OPC designs used for numerical analyses, the refractive index  was also set as 1.7, while  was chosen as 0. For each diffractive feature, the thickness value ℎ is composed of two parts: a constant ℎ base that serves as the substrate support and a variable ℎ learnable , i.e., ℎ = ℎ learnable + ℎ base (6), where ℎ learnable represents the learnable thickness value of each diffractive feature and is constrained within the range [0, ℎ max ].For the diffractive design shown in Fig. 2b, ℎ max is set as 1.07 mm, covering a full phase modulation range from 0 to 2π for  = 0.75 mm.ℎ base is empirically chosen as 0.2 mm to provide the substrate (mechanical) support for the diffractive features.
We employed the band-limited angular spectrum approach 28 to simulate the free-space propagation of coherent optical fields between the diffractive layers, where the resulting field is subsequently modulated by the transmittance (, ,  +1 ) of the (+1) th diffractive layer.This process can be written as: where   and   represent the spatial frequencies along the x and y directions, respectively.
For numerical simulations of all the diffractive designs presented in this manuscript, the spatial sampling rate of the simulated complex fields is set as 0.4 mm, i.e., ~0.53.The lateral dimension of the individual diffractive features on the diffractive layers was also set as 0.4 mm.The axial spacing between the adjacent layers (including the diffractive layers and input/output planes) was selected as 12 for the numerical design shown in Fig. 1a and 20 for the experimental validation design shown in Fig. 5a.

Numerical implementation of the diffractive OPC processors and phase-conjugate mirrors
In our diffractive OPC network design, a phase-only object is set to be positioned at  =  0 , featuring a phase profile (, ) and uniform distribution of unit amplitude.This object is illuminated by a coherent, uniform plane wave, generating an input complex field  that can be mathematically described as: .
Here  can also be denoted as  1 , i.e.,  1 (, ,  0 ) =  (,) .Subsequently, as the input light propagates through the diffractive network volume, the input field  (or  1 ) is subject to a series of diffractive layer modulations and secondary wave formations detailed in the last subsection, ultimately resulting in an output complex field (, ) =   (, ,   ).
For the diffractive OPC processor design depicted in Fig. 2a, both the input and output apertures are designed to have a circular shape with a diameter of ~59.36.The input/output apertures are discretized into 560 pixels, each measuring a size of ~2.12 × 2.12.To ensure the successful execution of the desired OPC task, each diffractive layer within this diffractive OPC network is designed to contain 200 × 200 diffractive features, spanning an area of ~106 × 106.For the experimental design shown in Fig. 5a, the input and output apertures are square-shaped and share identical dimensions of ~29.68 × 29.68.The input/output apertures are sampled into arrays of 28 × 28 pixels, leading to an individual pixel size of ~1.06 × 1.06.The diffractive layers in this design contain 120 × 120 diffractive features (for each layer), spanning an area of ~64 × 64.
For the diffractive phase-conjugate mirror design illustrated in Fig. 9a, the settings of the input/output apertures and the diffractive layers align with those of the diffractive OPC processor design depicted in Fig. 2a.The main change in this set-up is the integration of a standard mirror placed to the right of the diffractive layers, and the output aperture coincides with the location of the input aperture (  =  0 ), allowing OPC to operate in reflection mode.In the numerical simulation, a  phase shift was introduced at the standard mirror reflection.

Details of the experimental diffractive OPC system
For the experimental set-up, we designed a diffractive OPC processer composed of three isotropic, phase-only diffractive layers ( 1 - 3 ) between two identical random unknown phase perturbation planes with a phase contrast parameter of  test = 0.5, axially spanning a distance of 80 from the first phase perturbation to the second phase perturbation plane, with a distance  m of 20 between successive diffractive layers.At the system's forefront, we placed a square-shaped aperture with a width of ~4.3, serving as a small pinpoint object .This initiates an input wavefront similar to a spherical wave, which travels a distance () of ~266 and subsequently encounters a random, unknown phase perturbation plane with 28×28 pixels.The illustrative design is shown in Fig. 5a.
To optimize the diffractive OPC network shown in Fig. 5b, we created a training dataset comprised of 50,000 randomly generated phase perturbation planes.Each of these planes was conceptualized as a phase-only mask, with complex transmission coefficients,   (, ), defined as: .
The random height map (, ) is defined as: , where (, ) follows a normal distribution with a mean  and a standard deviation  0 , i.e., (, )~(,  0 2 ) (12), () represents a Gaussian smoothing kernel with zero mean and a standard deviation of .The symbol " * " stands for the 2D convolution operation.Throughout this work, we used  = 25,  0 = 4, and  = 8 for the generation of the 50,000 random phase perturbation planes.Given these settings, the resulting average correlation length of phase perturbation can be calculated as ~14.7using a phase autocorrelation function 35,49 .
As shown in Fig. 5c, a terahertz continuous wave (CW) system was used to test our diffractive OPC design.In this system, we used a terahertz source consisting of a modular amplifier/multiplier chain (AMC) (Virginia Diode Inc. WR9.0M SGX/WR4.3x2WR2.2x2), coupled with a compatible diagonal horn antenna (Virginia Diode Inc. WR2.2).A 10-dBm radiofrequency (RF) input signal was generated at a frequency of 11.1111 GHz (fRF1) at the input of the AMC and was then multiplied by 36 times to generate the output CW radiation at 0.4 THz, corresponding to a wavelength of 0.75 mm.Also, the AMC output was modulated with a 1-kHz square wave for lockin detection.The 4-mm-width input aperture was positioned ~50 mm away from the exit aperture of the horn antenna.The intensity distribution within the output aperture was 2D-scanned at a step size of 0.8 mm by a single-pixel mixer (Virginia Diode Inc. WRI 2.2), which was mounted on an XY positioning stage constructed using two Thorlabs NRT100 motorized stages.A 10-dBm RF signal at 11.0833 GHz (fRF2) was also received by the detector to serve as the local oscillator to down-convert the output frequency to 1 GHz.This down-converted signal was then amplified using a low-noise amplifier (Mini-Circuits ZRL-1150-LN+) with a gain of 80 dBm and filtered through a bandpass filter at 1 GHz (+/-10 MHz) (KL Electronics 3C40-1000/T10-O/O), which mitigate the noise resulted from unwanted frequency bands.After the signal went through a tunable attenuator (HP 8495B) for linear calibration, it was then processed by a low-noise power detector (Mini-Circuits ZX47-60).The resulting output voltage from the detector was measured using a lock-in amplifier (Stanford Research SR830), where the 1-kHz square wave was used as the reference signal for calibration into a linear scale.
For the fabrication of the resulting diffractive OPC processor, a 3D printer (Objet30 Pro, Stratasys) was used to fabricate the diffractive layers shown in Fig. 5b.The phase perturbation planes and the input aperture were also 3D printed using the same printer (Objet30 Pro, Stratasys).To achieve alignment in accordance with our optical forward model of the experimental diffractive design, a 3D-printed holder was utilized to assemble the input aperture, the phase perturbation planes and the printed diffractive layers, ensuring their precise 3D positioning.

Fig. 3 :
Fig. 3: The impact of the phase contrast of aberrated input fields on the performance of OPC

Fig. 7 :
Fig. 7: The impact of the number of diffractive layers on the phase conjugation performance

Fig. 8 :
Fig. 8: Analysis of the tradeoff between the all-optical phase conjugation performance and

Fig. 9 :
Fig. 9: The diffractive phase-conjugate mirror design and the visualization of the output field .
2 =  tr  .During the training data generation, the coefficient  1 for each  was randomly chosen from the range [0.1 tr , 0.9 tr ].The polynomial mode numbers, ( 1 , 2 ) and ( 1 ,  2 ), were also randomly selected within the ranges of[-6, 6] and [0, 6], respectively, ensuring the selection only from the first 28 Zernike polynomials.With this formulation, each  possesses a dynamic range of [0,  tr ], where  tr denotes a training phase contrast parameter.In order to facilitate the diffractive OPC network's capability to perform all-optical phase conjugation across different input phase contrast values,  tr was randomly chosen between 0.2 and 1, i.e.,  tr ∈ [0.2, 1].Based on this diverse set of , we also generated their conjugated versions as the training target (ground truth) of our diffractive OPC processor, thus forming a training dataset consisting of 200,000 input/target complex field pairs.
test range, which falls within our training ( tr,max = 1).For example, for  test = 0.2, the phase MAE value drops to 0.14 ± 0.03%, highlighting the diffractive OPC model's excellent performance for a smaller range of phase aberrations.However, for  test > 1 (which is outside of our training range), error margins widen considerably, with the most pronounced increase observed at  test = 1.99,where the phase MAE value escalates to 6.83 ± 0.78%, a value nearly four times greater than its counterpart at  test = 1, which stands at 1.71 ± 0.14%.These observations are accentuated in Fig.3b, which depicts the diffractive output fields at  test = 0.2, 1.0 and 1.8.For larger phase aberrations corresponding to out-of-distribution test values with  test > 1, there is a notable decline in the accuracy of the amplitude and phase output profiles of the diffractive OPC processor.This phenomenon stems from the fact that the universal linear transformation capability of a diffractive design provides a less accurate approximation for the OPC operation, which increases the output errors for larger phase aberration values corresponding to  test > 1.
never seen by the diffractive OPC model during its training process.As shown in Fig.3a, the resulting normalized amplitude and phase MAE values, plotted as a function of  test , reveal a rising error trend as  test increases.Notably, when  test < 1, our diffractive model consistently delivers phase MAE values below 2%, showcasing its adeptness at phase conjugation tasks in this