## INTRODUCTION

Nearly a century after quantum mechanics revolutionized the way we understand nature, quantum resources such as superposition and entanglement are beginning to enter and transform technology (*1*). Many implementations of quantum technologies, such as quantum communication (*2*) and quantum imaging (*3*), are based on photonic platforms that encode quantum bits (qubits) using single photons. One of the main challenges in these applications is the low flux of single photons that can be sent per communication channel or image pixel, resulting in extremely low capacities of these systems. A promising approach for boosting the capacity of quantum systems is to encode multilevel quantum bits (coined “qudits”) using a single photon in a d-dimensional Hilbert space (*4*). To this end, photonic qudits have been implemented in the temporal (*5*), spectral (*6*) and spatial (*7*) domains. The spatial domain is particularly attractive, since using spatial light modulators (SLMs), it is possible to arbitrary rotate qudits in the d-dimensional space, simply by shaping the spatial distribution of photons (*8*). However, this also implies that the information carried by spatial qudits is extremely sensitive to scattering and aberrations, acting as random rotations on the qudits. For example, scattering of entangled photons that encode spatial qudits scrambles their unique quantum correlations, resulting in a random grainy spatial correlation pattern, coined “two-photon speckle” (*9*). Scattering of photonic qudits is therefore a limiting factor in implementing photonic quantum technologies in real-world applications, such as ground-satellite quantum communication (*2*) or quantum imaging of biological samples. In the past few years, extensive research was devoted to protecting the information carried by spatial qudits, by encoding them in spatial modes that are immune to scattering and aberrations (*10*, *11*). Nevertheless, for strong scattering, all spatial modes will eventually suffer from scrambling of the information carried by the photons (*12*).

A promising approach for cancelling scattering of classical light is wavefront shaping. Over a decade after the pioneering work of Vellekoop and Mosk (*13*), who focused classical light through scattering media using an SLM, a remarkable set of tools for controlling light in random media has been developed (*14*, *15*). It is therefore appealing to adopt these tools to the quantum regime. Over the past few years, several important developments toward spatial control of single and entangled photons have been reported (*16*–*20*). Nevertheless, for practical applications such as quantum technologies, real-time optimization and feedback must be performed, which is particularly challenging due to the inherently weak quantum signals. In most demonstrations to date, photon pairs generated by spontaneous parametric down conversion (SPDC) were sent to an SLM that directly shaped their spatial distribution before hitting a scattering sample, and the optimization was performed in advance using an auxiliary classical laser at the same wavelength as the entangled photons (*16*–*19*). In a few other demonstrations, the SLM modulated the bright laser beam that stimulates the SPDC process (coined “pump beam”), and feedback was provided by the inherently weak quantum signal (*21*, *20*). Thus, despite the substantial progress made, all demonstrations to date do not overcome the fundamental challenge of providing fast feedback in real time and thus cannot be implemented in real-world applications.

In this work, we demonstrate a method for compensating the scattering of entangled photons that allows real-time optimization of quantum correlations (Fig. 1A). Our method consists of two main components: shaping and feedback. First, instead of shaping the entangled photons directly, we use the well-known technique of pump shaping (*20*–*24*) to control the correlations of the entangled photons, thus avoiding additional loss to the quantum link. Second and most importantly, we use the intensity of the classical pump beam for the feedback on the entangled photons. Because we use the classical pump beam both for control and feedback, the well-established toolbox of classical wavefront shaping can be trivially extended to the quantum regime, opening the door for implementing wavefront shaping in quantum technologies. We explain this notable result by showing, both theoretically and experimentally, that when the pump beam scatters by the same random sample as the entangled photons, the spatial distribution of its intensity is identical to the spatial correlations of the entangled photons. Hence, any manipulation of the classical pump intensity has an identical effect on the entangled photons correlations. Because wavefront shaping of a classical bright beam is much faster and more efficient than shaping weak fluxes of entangled photons, we were able to demonstrate real-time wavefront correction of entangled photon scattered by a dynamically moving diffuser. Last, we show, using numerical simulations, that our method allows substantial improvement of free-space quantum links by compensating the effect of turbulence on the entangled photons.

## RESULTS

To explain why scattering of two entangled photons corresponds to scattering of a single pump photon at half the wavelength, we write the quantum state of the two photons (coined “signal” and “idler” photons), in terms of their transverse wave vector components **q**_{s} and **q**_{i}, ∣ψ〉 = ∫ *d***q**_{s}*d***q**_{i}ψ(**q**_{s}, **q**_{i})*a*^{†}(**q**_{s})*a*^{†}(**q**_{i})∣0〉. Here, *a*^{†}(**q**) is the creation operator of a photon with a transverse momentum **q**, ∣0〉 is the vacuum state, and we assume that the signal and idler photons have the same frequency and polarization. The two-photon amplitude ψ(**q**_{s}, **q**_{i}) can be expressed in terms of the angular spectrum of the pump beam *v*(**q**) (*22*)

(1)where

$\mathrm{\Phi}(\mathbf{q})\propto \text{Sinc}\left(\frac{L}{4k}{\mathbf{q}}^{2}\right)$ is the phase-matching function of the SPDC crystal, *L* is the crystal length, and *k* is the pump wave number inside the crystal. The number of inseparable modes in the superposition of the two-photon state, quantified by the Schmidt number *K*, is proportional to the ratio between the width of the phase-matching function Φ(**q**) (determined by the crystal length *L*) and the width of the pump angular spectrum function *v*(**q**) (determined by the width of the pump beam). In the so called thin-crystal regime, *K* ≫ 1, the two-photon state can be approximated by ψ(**q**_{s}, **q**_{i}) ∝ *v*(**q**_{s}*+*q_{i}) (*22*), yielding an Einstein-Podolsky-Rosen entangled state (*25*). In this regime, we can precisely control the two-photon amplitude by tailoring the angular spectrum of the pump beam or, equivalently, by controlling its spatial profile, *W*(**ρ**), at the input plane of the crystal.

We start by considering a thin diffuser placed right after the crystal, which can be modeled by a linear transformation on the creation operator *a*^{†}(**q**) → ∫ *d* **ρ***a*^{†}(**ρ**)*A*_{d}(**ρ**) exp (*i***ρ** · **q**), where *A*_{d}(**ρ**) is the amplitude transfer function of the thin diffuser and **ρ** is the transverse spatial coordinate. We note that if the diffuser is not located right after the crystal, then it can always be reimaged on the crystal plane, as in conjugate-plane adaptive optics (*26*). Experimentally, the two-photon quantum state is measured using two single-photon detectors placed at the far field of the crystal. The rate of coincidence events, i.e., detection of two photons simultaneously, one photon with transverse wave vector **q**_{s} and the other with transverse wave vector **q**_{i}, is given by *C*(**q**_{s}, **q**_{i}) = ∣〈 0 ∣ *a*(**q**_{i})*a*(**q**_{s}) ∣ ψ 〉 ∣^{2}, yielding (see the Supplementary Materials) (*27*)

(2)

For random diffusers, the spatial distribution of the coincidence pattern *C*(**q**_{s}, **q**_{i}) exhibits a random two-photon speckle pattern (*9*). In the absence of loss, the thin diffuser acts as a phase mask, *A*_{d} = exp (*i*ϕ(**ρ**)); hence, the right-hand side of Eq. 2 corresponds to the far-field intensity profile of the pump beam in the direction **q** = **q**_{i} + **q**_{s} (see the Supplementary Materials). The meaning of this correspondence is that even though the wavelength of the pump beam is drastically different from that of the entangled photons, their far-field speckle patterns are identical. This notable result can be intuitively understood by noting that the two photons pass through the diffuser at the same location; hence, the two-photon amplitude accumulates twice the single-photon phase, as would a photon with half the wavelength. Hence, by measuring the intensity profile of the pump beam, we get the spatial distribution of the two-photon state. Because this is true for any pump profile *W*(**ρ**), using an SLM, we can optimize the pump profile to get a focused pump spot at the far field of the diffuser, and the quantum correlations between the photons will become spatially localized, simultaneously. In case the diffuser is lossy, the pump intensity and the coincidence pattern may not be identical. Nevertheless, optimizing the pump profile will still localize the two-photon spatial correlations (see the Supplementary Materials). The fact that pump optimization simultaneously localizes the two-photon correlations is a remarkable feature of spatially entangled photons. It offers orders-of-magnitude faster feedback than would have been possible with the inherently weak signal provided by the coincidence rate, allowing us to extend wavefront shaping to the quantum domain by applying classical wavefront shaping to the bright pump beam.

The quantum wavefront shaping experimental setup is depicted in Fig. 1A. A 2-mm-long periodically poled KTP (PPKTP) crystal is pumped by a continuous-wave laser (λ = 404 nm), which is shaped by a phase-only SLM imaged on the input facet of the crystal. The SPDC process in the crystal generates a continuous flux of entangled photon pairs, with a Schmidt number of *K* ≈ 680 (Fig. 1, B and C, and the Supplementary Materials). After the crystal, both the pump beam and the entangled photons are scattered by a thin diffuser located at the image plane of the crystal, creating a fully developed speckle pattern with no ballistic component. The pump intensity and the two-photon coincidence patterns are measured at the far field of the crystal, after separating the pump and entangled photons using a dichroic mirror. The coincidence patterns at the far field are measured using two single-photon detectors, where one detector is scanning while the other is always kept stationary.

Figure 2 (A and B) depicts the measured pump intensity and two-photon coincidence rate at the far field of the diffuser. Although the wavelength of the entangled photons is twice the wavelength of the pump photons, the two signals exhibit notably similar patterns, as predicted by Eq. 2. The wavelength difference comes into play only in the scaling of the two patterns, as the two-photon pattern is stretched by a factor of 2 compared with the pump pattern (see the Supplementary Materials). Because the pump and two-photon speckle patterns are remarkably similar, we can apply wavefront shaping optimization to the classical pump beam, and the quantum two-photon correlations will be optimized simultaneously. Specifically, we use the partitioning optimization algorithm to enhance the intensity of the pump beam at an arbitrary point at the far field of the diffuser (*15*) (Fig. 2D). In this algorithm, the phase of half of the SLM’s pixels is modulated in each step, and the optimal phase is chosen so that the intensity at the target area is optimized. This specific algorithm was chosen as it is less sensitive to noise and has a fast initial convergence (*15*). With the exact same phase mask applied to the pump beam, the two-photon coincidence pattern is measured, showing a clear enhancement and localization of the two-photon correlations at the target area (Fig. 2E). The single-photon counts (Fig. 2, C and F) are not affected by the scattering nor by the optimization, because of the multimode nature of SPDC light in the high Schmidt number regime (*9*).

One of the main challenges in adopting wavefront shaping to real-world applications is scattering by a varying medium, for example, in communication through turbulent atmosphere (*2*, *28*), as it requires fast modulation rates and sufficient signal-to-noise ratios (SNRs) at short integration times. The need for fast modulation rates is common for both classical and quantum wavefront shaping. This can be solved by recent breakthroughs providing high modulation rates, ranging from a few tens of kilohertz using digital mirror devices (*29*) to 350 kHz using one-dimensional microelectromechanical system (MEMS) (*30*). The need for high SNR at short integration times is, in particular, critical for single and entangled photons, because quantum signals are too weak for real-time optimization (*20*, *31*). This is usually solved by performing the wavefront optimization on an auxiliary bright laser that is carefully coaligned with the entangled photons so that it undergoes the exact same scattering (*16*–*19*). While this approach enables fast optimization, it does not allow simultaneous transmission of the entangled photons because the auxiliary laser must have the same wavelength and polarization as the entangled photons and thus cannot be filtered out. For this reason, dynamical shaping, although crucial to many quantum technologies, has not been achieved so far for entangled photons. Because in our method the optimization is done entirely on the classical bright pump beam, the optimization rates can, in principle, be as fast as record-high classical wavefront shaping, making quantum wavefront shaping applicable for real-time applications. To demonstrate this feature, we emulate dynamical scattering by placing a diffuser on a moving stage, producing a time-dependent speckle pattern. First, we use a diffuser with a relatively long correlation time, for which the coincidence signal can be measured during the optimization (Fig. 3A). When the optimization is turned on, both the pump (blue curve) and coincidence (red curve) signals are enhanced simultaneously, even though the diffuser is constantly moving. Although the diffuser has a relatively long correlation time, when the same optimization algorithm is used with the coincidence rate for the feedback, no enhancement is observed because of the poor SNR of the coincidence signal (black curve). In Fig. 3B, we increase the speed of the moving diffuser, yielding a much shorter correlation time, which limits the number of coincidence measurements that can be performed. Nevertheless, the pump beam intensity is still enhanced by the optimization process (blue curve), causing the coincidence signal to increase as well (red points), highlighting the strength of our use of the pump beam as feedback for real-time optimization.

Next, we turn to discuss the expected classical and quantum enhancements of the optimization process. Let

${\mathrm{\beta}}_{\mathrm{p}}^{(1)}$and

${\mathrm{\beta}}_{\text{DC}}^{(2)}$be the pump intensity and entangled photons coincidence counts at the chosen target area, respectively, normalized by the total signal. We distinguish between the effects of absorption and scattering on β. In the case of absorption, the relation between the pump and coincidence signals is quadratic

${\mathrm{\beta}}_{\text{DC}}^{(2)}={{\mathrm{\beta}}_{\mathrm{p}}^{(1)}}^{2}$, as we experimentally confirm using a variable attenuator (Fig. 4, A and B). This relation results from the fact that for a coincidence event, both photons must be transmitted through the absorbing media. However, for a purely scattering sample, the situation can be quite different. Although in the weak pumping regime the coincidence signal is always linear with the intensity of the pump beam, this relation becomes more complicated when considering the signals at a target area smaller than the whole emission area, where a quadratic dependency might be expected (see the Supplementary Materials). To illustrate this, we measure the two-photon signal

${\mathrm{\beta}}_{\text{DC}}^{(2)}$and the corresponding pump signal

${\mathrm{\beta}}_{\mathrm{p}}^{(1)}$at different stages of the optimization process (Fig. 4A). We get a clear linear dependency,

${\mathrm{\beta}}_{\text{DC}}^{(2)}={\mathrm{\beta}}_{\mathrm{p}}^{(1)}$ (Fig. 4B). The linear rather than quadratic dependence is a unique feature of entangled photons in the high Schmidt number regime *K* ≫ 1, which are scattered by a thin diffuser. To elucidate this, we numerically simulated the pump and two-photon speckle patterns formed at the far field. The simulation was performed for two-photon states with different Schmidt numbers (corresponding to different crystal lengths) using the double-Gaussian approximation (*32*). In Fig. 4C, the calculated correlation coefficient between the two patterns is plotted versus the Schmidt number *K*. At *K* = 1, there is almost no correlation between the patterns, as expected from two different wavelengths. However, as the Schmidt number increases, the patterns become increasingly correlated, yielding almost perfect correlation in our experimental conditions at *K* ≈ 680. The experimental correlation coefficient between the two patterns presented in Fig. 2 (A and B) is 0.83. This result completes the picture given by Eq. 2 and Fig. 2 (A and B) and explains the correspondence between the pump beam and entangled photon pairs in the high Schmidt number regime that yields

. We can now easily derive the expected enhancement

${\mathrm{\eta}}_{\text{DC}}^{(2)}$of our optimization method, defined by the ratio of the coincidence rate at the target area after optimization and the average coincidence rate at the target area before optimization. As a consequence of the linear correspondence that we established between the pump and two-photon signals, the coincidence enhancement

${\mathrm{\eta}}_{\text{DC}}^{(2)}$ must be exactly equal to the classical enhancement of the pump beam (*15*)

(3)where *N* is the number of degrees of freedom used in the optimization. We therefore conclude that in our method, the efficiency of the quantum optimization is identical to the efficiency of classical wavefront shaping.

Thus far, we considered a transparent thin diffuser placed at the image plane of the nonlinear crystal. Because in this configuration the signal and idler photons pass the diffuser at the same location, it induces the same phase on both photons. The two-photon amplitude therefore accumulates the same phase as the pump amplitude, and the far-field speckle patterns of the pump beam and the entangled photons are identical. The signal and idler photons do not have to pass through the same location in the diffuser, as long as they accumulate the same phase. It is therefore enough to require that the photons pass the diffuser through the same coherence area, defined by a typical scale *d* over which the phases induced by the diffuser become uncorrelated (*33*). Pump feedback can therefore work even when the diffuser is neither thin nor perfectly imaged to the crystal, as long as the thickness of the diffuser or its distance from the image plane is smaller than *d*^{2}/λ (see the Supplementary Materials). The efficiency of the optimization will also depend on the position of the stationary detector at the far field, because when the thickness of the diffuser is larger than its coherence length *d*, it exhibits a finite “memory effect,” i.e., a finite range of angles over which the speckle patterns remain correlated (*34*). The finite memory effect limits the range of target areas that can be optimized simultaneously.

In Fig. 5 (A and B), we demonstrate the use of pump shaping to compensate volume scattering of entangled photons by two thin diffusers separated by *z* ≈ 3 mm, creating an effective diffuser with thickness *z* such that *d* ≪ *z* < *d*^{2}/λ, where *d* ≈ 100 μm. This double-diffuser configuration exhibits a narrow memory effect range (see the Supplementary Materials). Optimizing the pump beam makes the coincidence pattern localized (Fig. 5B). When displacing the stationary idler detector, the coincidence rate at the target area decreases because of the finite memory effect associated with the double-diffuser configuration.

The *d*^{2}/λ limitation on the thickness of the diffuser restricts the range of practical applications that can benefit from pump optimization. Nevertheless, for free-space quantum links through turbulent atmosphere, pump optimization can markedly improve the efficiency of the link, because the transverse coherence length of the atmosphere *d* is many orders of magnitude larger than the optical wavelength λ (Fig. 5C). We use Kolmogorov’s phase screen model for turbulence to numerically simulate the efficiency of our pump optimization method for free-space optical links (see the Supplementary Materials). Figure 5D compares the coincidence rate at the target area as a function of the length of the optical link, with and without using pump optimization. The simulation is performed for three different turbulence strengths, ranging from weak to moderate turbulence, quantified by the structure constant of the refractive index fluctuations

(*35*). A two-orders-of-magnitude improvement in the accessible link length is achieved for all turbulent conditions. The improvement grows with the turbulence strength (see the Supplementary Materials). To estimate theoretically the maximal expected link length, it is useful to introduce the Rytov variance

, which quantifies the strength of scintillation in the optical link, where

${\mathrm{\sigma}}_{\mathrm{R}}^{2}>1$ is considered moderate to strong scintillation (*36*). Using the reasoning presented above for a volume diffuser, we found that our method will allow efficient optimization for links with moderate scintillation of up to

(see the Supplementary Materials).

## DISCUSSION

Our approach for shaping entangled photons, by creating them with the correct spatial correlations to compensate for the scattering, has several unique advantages over directly shaping them after their creation. First, because it is based on shaping the classical pump beam without interacting with the entangled photons themselves, it does not introduce any loss to the entangled photons. Second, because the classical pump beam is used for the optimization feedback, the optimization can be as fast as shaping of bright classical light. Moreover, because we could easily separate the pump photons from the entangled photons, we were able to cancel scattering of entangled photons from a dynamically moving diffuser without interfering their continuous transmission. This is an important step toward implementing quantum wavefront shaping in real-life scenarios, because there is no downtime for the transmission of the photons while the optimization process is performed.

Because the pump optimization works best for scattering layers with thicknesses that are smaller than

$\frac{{d}^{2}}{\mathrm{\lambda}}$, implementation of our method in practical applications requires that the transverse coherence length of the scattering layer *d* will be much larger than the optical wavelength λ. As quantum communication through turbulent atmosphere falls exactly in this realm, we believe that the method we developed in this work can play an important role in extending available communication distances in scenarios where atmospheric turbulence limits the communication links. In particular, it fits protocols where two entangled photons are sent to the same target. Examples include quantum dense coding (*37*, *38*), high-capacity quantum key distribution (*39*, *40*) and direct quantum communication (*41*). These protocols often require a delay between the two photons, where one of the photons is sent after its twin photon has arrived at the receiver. Our scheme can be directly applied to these protocols as long as the delay between the two photons is shorter than the correlation time of the atmospheric link. Because atmospheric correlation times for ground-satellite channels are in the range of 1 to 10 ms (*42*), the first photon can travel hundreds of kilometers before its twin photon needs to be sent, enabling, for example, communication with Low Earth Orbits satellites. Moreover, our pump shaping approach can be extended also to protocols based on transmitting only one photon of an entangled pair. The required phase correction for focusing only one of the photons is no longer the phase that focuses the pump beam. Nevertheless, it is still possible to derive the required phase for single-photon focusing from the phase found by the pump beam optimization, because by optimizing the pump beam, we characterize the phase distortions induced by the medium. For example, for the simple case of weak aberrations, the phase required for focusing a single photon is half the phase required for focusing the pump. Applying this approach to strong phase distortions might result in 2π ambiguities, yet those can be resolved by coherent detection of the pump speckles or by using phase retrieval algorithms. In addition, we note that our pump-shaping protocol has potential applications that require sending two entangled photons through turbid media beyond quantum communication, e.g., entangled two-photon spectroscopy (*43*) and microscopy (*44*). Last, we note that pump shaping can be used to create a two-photon source with tailored correlations and coherence properties by shaping both the amplitude and phase of the pump beam (*45*, *46*), opening the door for exploiting the capacity of high-dimensional qudits implemented in the spatial domain.

**Acknowledgments: **We thank H. Defienne for useful discussions. **Funding:** This work is supported by the Zuckerman STEM Leadership Program, the Israel Science Foundation (grant no. 1268/16), and the Israeli Ministry of Science. **Author contributions:** O.L. and Y.B. designed the experiment. O.L. and G.H. built the experimental setup and performed measurements. O.L. analyzed and interpreted the data. All authors contributed to the manuscript. **Competing interests:** The authors declare that they have no competing interests. **Data and materials availability:** All data needed to evaluate the conclusions in the paper are present in the paper and/or the Supplementary Materials. Additional data related to this paper may be requested from the authors.