Introduction

A wide range of modern applications across biology1, medicine2, finance3, and social networks4 benefit from efficient processing and optimization of big data with complex structures and correlations. However, many such tasks are non-deterministic polynomial-time (NP) hard, which could take existing supercomputers years to solve5. In this challenge, intense research efforts are underway to pave alternative approaches for computing and information processing. Among them, Ising machines have been shown to offer viable solutions for important NP hard problems such as cut with maximum number of edges (MAX-CUT) in a graph6, protein folding7, and traveling salesman8, among others9,10,11,12,13,14,15. To this end, a variety of Ising machines have been demonstrated in (effective) spin systems of trapped atoms16, polariton condensates17, and superconducting circuits18. Some other artificial Ising machines have also been implemented using coupled oscillators19,20,21, nanophotonic waveguides22,23, randomly coupled lasers24,25, and time-multiplexed optical parametric oscillators26,27.

For the tasks of finding the ground states of many-body Hamiltonians, photonic systems enjoy the distinct advantages of high connectivity and speed28,29,30. For example, a fast coherent Ising machine can be realized in a looped optical parametric oscillator with temporally multiplexed pulses31,32, albeit with limited spin numbers31 or relying on photodetection and electronic feedback to emulate the spin–spin interaction33,34. In contrast, a linear-optical Ising machine based on spatial light modulation was shown to subtend about 80,000 spins by coding them as the binary phases of pixels on a spatial light modulator (SLM)35. The far-field optical power of a modulated beam gives the expected energy of spin–spin interaction. The relatively simple setup, yet high connectivity and scalability make this approach attractive to Ising machines with fully connected two-body interaction.

Yet, there are physical systems and numeric models whose dynamics cannot be fully captured by two-body interactions, and proper descriptions of multi-body interaction are required36,37,38,39,40. Some of the NP hard problems are rooted in the multi-body interactions present in the spin system. For example, the Boolean satisfiability (k-SAT) problem is NP hard when k ≥ 3, where k prescribes the order of interactions or constrains41. This poses a significant computational challenge, whose complexity and volume exceed by far that of Ising problems with only two-body interaction, even for a moderate number of spins42,43. Although a small class of many-body interaction can be decomposed onto a series of two-body interactions via some recursive or algebraic means44,45,46, they often subject to strict constraints47,48 or require tedious error corrections49,50. For simulating complex systems and processing data with high-order correlation, suitable Ising machines remain desirable that support simultaneously high connectivity, multi-body interaction, and a large number of spins.

In this study, we propose and experimentally demonstrate such an Ising machine hosting adjustable two-body interaction, four-body interaction, and all-to-all connections over a large number of spins. It realizes the spins as the binary phases of wavelets in a coherent laser beam, and implements effective multi-body interaction through nonlinear frequency conversion. Using SLM’s (or equivalently, digital micromirror devices (DMDs)), one million spins are possible at present, although optical imperfections must be taken into account and could limit the actual accessible spin number in practice. The fully connected two-body interaction is emulated with the optical power of the modulated light in the Fourier plane. The four-body interaction, also fully connected, is realized effectively by passing the modulated light through a lithium-niobate crystal in the Fourier plane for second harmonic (SH) generation. By simultaneously measuring the optical powers of the modulated light and its SH coupling into a fiber, complex Hamiltonians with all-to-all connected two-body and four-body interactions can be emulated over a large number of spins. Through feedback control, the system can be evolved into the vicinity of the ground state of its Hamiltonian, exhibiting ferromagnetic, paramagnetic, spin glass, and other novel nonlinear susceptibility phase transitions.

The present Ising emulator could pave a pathway to otherwise inaccessible territories of big data analytics and quantum simulation39,40. The high-order, many-body interaction can also serve as powerful activation functions for all optical machine learning51,52. For example, an immediate application is to use this machine as the q-state Potts model with two-body and four-body interactions on a square lattice53. Finally, while the current setup uses SH generation, even richer physics and controllability can be achieved by using other nonlinear optical processing like sum-frequency generation54, and four-wave mixing55, where other types of spin interaction and connection can be engineered.

Results

Theoretical analysis

The basic idea of the present Ising machine is illustrated in Fig. 1, which emulates chemical potential, two-body interaction, and four-body interaction over a large number of spins. Each spin is encoded as the binary phase of a pixel on a SLM. The total chemical potential energy is represented by the weighted sum of all spins. To realize the interactions, a coherent Gaussian pump beam is reflected off the SLM, focused using a Fourier lens to a nonlinear crystal for SH generation. The resulting beams at the original fundamental wavelength and the new SH wavelength are then separated at a dichroic mirror and captured by optical fibers. The pump power in the fiber is then measured to emulate the energy associated with spin–spin interaction, and that of the SH beam is to capture the four-body interaction among spins. Incorporating all three, a Hamiltonian describing the chemical potential, two-body interaction, and four-body interaction can be effectively constructed.

Fig. 1: Illustration of a nonlinear optical Ising machine.
figure 1

The spins are encoded as the binary phase on a spatial light modulator (SLM). H1, H2, and H4 represents the chemical potential, all-to-all two-body and four-body interactions, respectively. In our case, three-body interactions (H3) are not present. The pump and second harmonic beams are shown in red and blue colors, respectively.

To derive the effective Hamiltonian, we consider a Gaussian input pump beam of wavelength λp, peak amplitude E0, and beam waist wp. It shines a SLM whose phase mask consists of pixels (mn) centered around \(({x}_{m}^{\prime},{y}_{n}^{\prime})\), each giving 0 or π phase modulation. The transverse electric field immediately after the SLM is approximately35

$${E}_{{\rm{p}}}(x^{\prime} ,y^{\prime} )=\mathop{\sum }\limits_{m=1}^{N}\mathop{\sum }\limits_{n=1}^{N}{\xi }_{mn}{\sigma }_{mn}\frac{1}{{a}^{2}}\Pi \left(\frac{x^{\prime} -{x}_{m}^{\prime}}{a}\right)\Pi \left(\frac{y^{\prime} -{y}_{n}^{\prime}}{a}\right).$$
(1)

Here \({\xi }_{mn}={E}_{0}\exp \left[-({x}_{m}^{^{\prime} 2}+{y}_{n}^{^{\prime} 2})/{{\rm{w}}}_{{\rm{p}}}^{2}\right]\) is the amplitude at pixel (mn), Π is the unity rectangular function, and σmn = ±1 for the 0/π binary phase modulation.

The electric field is then transformed using a Fourier lens of focal length F and coupled into a periodic-poled lithium niobate (PPLN) crystal of length L, so that it reads at the center of the crystal (z = 0):

$$ {E}_{{\rm{p}}}(x,y,z=0)\\ \quad=\mathop{\sum }\limits_{m=1}^{N}\mathop{\sum }\limits_{n=1}^{N}{\xi }_{mn}{\sigma }_{mn}{\eta }_{mn}{\rm{sinc}}\left(\frac{ax\pi }{{\lambda }_{{\rm{p}}}F}\right){\rm{sinc}}\left(\frac{ay\pi }{{\lambda }_{{\rm{p}}}F}\right)\exp (i{\kappa }_{{\rm{p}}}z).$$
(2)

Here, \({\eta }_{mn}=\exp \left[-2\pi i(x{x}_{m}^{\prime}+y{y}_{n}^{\prime})/{\lambda }_{{\rm{p}}}F\right]\), κp = (2πnp)/λp, and np is the refractive index of the pump in the PPLN crystal. For simplification, we introduce contracted notations ξi and σi, with ξi=m+(n−1)N ≡ ξmn, and σi=m+(n−1)N ≡ σmn, with i = 1, 2, . . . N2 to index the N × N spins (pixels). In our setup, only near-axis light is fiber coupled and measured, so that sinc(axπ/λpF), sinc(ayπ/λpF) ≈ 1, giving

$${E}_{{\rm{p}}}(x,y,z)\approx \mathop{\sum }\limits_{i=1}^{{N}^{2}}{\xi }_{i}{\sigma }_{i}{\eta }_{i}\exp (i{\kappa }_{{\rm{p}}}z).$$
(3)

In the PPLN crystal, the pump creates its SH, whose transverse electric-field at the output reads

$${E}_{{\rm{h}}}(x,y,L/2)={\rm{i}}\frac{{\omega }_{{\rm{h}}}^{2}{\chi }^{(2)}L}{2{c}^{2}{\kappa }_{{\rm{h}}}}{E}_{{\rm{p}}}^{2}(x,y,-L/2),$$
(4)

where χ(2) is the second-order nonlinear susceptibility, κh = (2πnh)/λh is the wave number, nh is refractive index, and ωh is the angular frequency of the SH wave. The nonlinear dynamics inside the crystal is shown in the Supplementary Note 1. At the crystal output, the pump and SH waves are each coupled into a single-mode fiber for detection, whose optical power is given by

$${P}_{{\rm{p,h}}}={\left|\iint {E}_{{\rm{p,h}}}(x,y){E}_{{\rm{f}}}^{{\rm{p,h}}}dxdy\right|}^{2}.$$
(5)

where

$${E}_{{\rm{f}}}^{{\rm{p,h}}}=\sqrt{\frac{2}{\pi }}\frac{1}{{w}_{{\rm{f}}}^{{\rm{p,h}}}}\exp \left(-\frac{{x}^{2}+{y}^{2}}{{({w}_{{\rm{f}}}^{{\rm{p,h}}})}^{2}}\right),$$
(6)

are the normalized back-propagated fiber modes of beam waist \({w}_{{\rm{f}}}^{{\rm{p}}}\) and \({w}_{{\rm{f}}}^{{\rm{h}}}\) for the pump and SH waves, respectively.

Substituting Eqs. (3), (4), and (6) in Eq. (5), the detected power for the pump and SH waves is given in the form of

$${P}_{{\rm{p}}}=\mathop{\sum }\limits_{i=1}^{{N}^{2}}\mathop{\sum }\limits_{j=1}^{{N}^{2}}{J}_{ij}{\sigma }_{i}{\sigma }_{j},$$
(7)

and

$${P}_{{\rm{h}}}=\mathop{\sum }\limits_{i=1}^{{N}^{2}}\mathop{\sum }\limits_{j=1}^{{N}^{2}}\mathop{\sum }\limits_{s=1}^{{N}^{2}}\mathop{\sum }\limits_{r=1}^{{N}^{2}}{J}_{ijsr}{\sigma }_{i}{\sigma }_{j}{\sigma }_{s}{\sigma }_{r},$$
(8)

where Jij and Jijsr prescribe the strength of the two-body and four-body interactions, respectively. As an example, Supplementary Note 2 presents the analytic results of Jij and Jijsr under the approximation of Eq. (4).

With Eqs. (7) and (8), we can define a single parameter E to characterize the energy of the whole system, as

$$E=\alpha C+\beta {P}_{{\rm{p}}}+\gamma {P}_{{\rm{h}}},$$
(9)

where \(C=\mathop{\sum }\nolimits_{i = 1}^{{N}^{2}}{\mu }_{i}{\sigma }_{i}\) is the weighted sum of spins that represents their total chemical energy, with the local chemical potential μi [−1, 1]. In this equation, α, β, and γ are free parameters defining the contribution of the chemical potential, two-body, and four-body interaction energy, respectively, to the total energy.

The total energy E can be minimized by optimizing the binary phase mask on the SLM through adaptive feedback control. This is equivalent to finding the ground-state solutions of the effective Hamiltonian

$${\bf{H}}=\alpha {\hat{H}}_{1}+\beta {\hat{H}}_{2}+\gamma {\hat{H}}_{4},$$
(10)

where \({\hat{H}}_{1}\) is the Hamiltonian describing the chemical potential, \({\hat{H}}_{2}\) for the two-body, and \({\hat{H}}_{4}\) for the four-body interaction, respectively, with

$${\hat{H}}_{1}=\mathop{\sum }\limits_{i=1}^{{N}^{2}}{\mu }_{i}{\hat{S}}_{i},$$
(11)
$${\hat{H}}_{2}=\mathop{\sum }\limits_{i=1}^{{N}^{2}}\mathop{\sum }\limits_{j=1}^{{N}^{2}}{J}_{ij}{\hat{S}}_{i}{\hat{S}}_{j},$$
(12)

and

$${\hat{H}}_{4}=\mathop{\sum }\limits_{i=1}^{{N}^{2}}\mathop{\sum }\limits_{j=1}^{{N}^{2}}\mathop{\sum }\limits_{s=1}^{{N}^{2}}\mathop{\sum }\limits_{r=1}^{{N}^{2}}{J}_{ijsr}{\hat{S}}_{i}{\hat{S}}_{j}{\hat{S}}_{s}{\hat{S}}_{r}.$$
(13)

The two-body and four-body interactions can be tailored by modulating the input pump wave, varying the fiber optical modes, and modifying the phase matching conditions for the nonlinear process. As an example, Fig. 2 considers a toy system of four spins, with the input pump partially blocked and the output pump and SH light across the remaining pixels coupled equally into the fiber mode. We can use a DMD, which can flexibly control no light and bright light regions in the input pump wave. The resulting interaction coefficients Jij and Jijsr are shown in Fig. 2a, b. For α = β = γ = −1, the system’s ground state is simply with all spin up. For all the possible spin configurations, we plot the probability distribution function of the energy (E) and magnetization, defined as \(M=\mathop{\sum }\nolimits_{i = 1}^{{N}^{2}}{\sigma }_{i}/{N}^{2}\), in Fig. 2c, d, respectively. As shown, the many-body interactions can be tailored into complex forms by simple linear optics operations.

Fig. 2: A toy Ising model with 4 spins.
figure 2

The second spin σ2 does not interact with the rest by blocking the input pump wavelet on the corresponding pixel. a The two-body interaction term Jij, with Ji2 = J2j = 0 for any ij (gray squares) and all other Jij = 1 (white squares). b The four-body interaction term Jijsr by the same color scheme. c, d The probability distribution function (PDF) of the energy and magnetization, respectively.

Experimental setup

The experimental setup for the present nonlinear optical Ising machine is shown in Fig. 3. We use an optical pulse train at 1551.5 nm as the pump. Each pulse has 5 ps full-width at half-maximum (FWHM) and 50 MHz repetition rate. The pump’s average power is about 40 mW and its pulse energy is  ~0.8 nJ. We use a portion of the input pump beam to monitor the power fluctuation which is <5% during a whole day operation. The transverse FWHM of the pump beam is 2.6 mm incident on the SLM (Santec SLM-100, 1440 × 1050 pixels, pixel pitch 10.4 × 10.4 μm) at a 50° incidence angle54,56. Initially, a random binary phase mask with phase value 0 or π is uploaded onto the SLM. Half waveplate is used to ensure the vertically polarized light parallel to the crystal’s optical axis. A lens focused the beams (focus length F = 200 mm) inside a temperature-stabilized PPLN crystal with a poling period of 19.36 μm (5 mol.% MgO-doped PPLN, 10 mm length, 3 mm width, and 1 mm height from HC Photonics) for SH generation. The pump beam waist inside the crystal is 45 μm. The output is then filtered with a dichroic mirror to separate the SH and pump light57. Each arm is coupled into a single-mode fiber (SMF-28) using a fiber collimator consisting of aspheric lens (Thorlabs C220TMD-C and A375TM-B) and then detected by power meters (Thorlabs PM-100D with sensors S132C and S130C). The measurement results are sent to a computer through a MATLAB interface for feedback control, which updates the phase mask on the SLM to find the ground state of the customized Ising Hamiltonian.

Fig. 3: Experimental setup for the present nonlinear optical Ising machine.
figure 3

Pump laser pulses at wavelength 1551.5 nm with 5 ps pulse width and 50 MHz repetition rate are incident on a spatial light modulator (SLM), and focused into a periodic-poled lithium niobate (PPLN) crystal to generate second harmonic (SH) light at wavelength 775.75 nm. After the crystal, the pump and SH beams are coupled into separate optical fibers and measured using power meters. BS beam splitter, CCD charged coupled device camera, HWP half waveplate, NIR near-infrared camera, PD photodiode, PM power meter, SMF single-mode fiber.

To visualize the evaluation of the optimization process, we can split the SH and pump light in two parts using flip-able beam splitters (BS). Lenses placed at one arm of the flip-able BS are used to image the pump on a near-infrared (NIR) camera (FIND-R-SCOPE Model No. 85700 with a pixel resolution of 17.6 μm) and the SH light on a charged coupled device (CCD) camera (Canon Rebel T6 with a pixel pitch of 4.3 μm). The present optical Ising machine is susceptible to the noises from a laser power fluctuation, beam misalignment, phase mismatching, etc. Those noises can be minimized by real time monitoring and periodically re-calibrating the input laser power, SH generation efficiency, temperature variation, optical alignment, fiber coupling efficiency, and so on.

Feedback-control optimization

As shown in Eq. (11), the chemical potential of each spin is flexibly defined by μi and their collective contribution to the total energy is controlled by α. This provides the knob of studying the magnetization under a variety of local and global single-spin parameters. For this paper, however, we will focus on the many-body interaction and consider only μi = 1 in all of the following results. Meanwhile, we will leave fine tuning two and four-body interaction to our future work, but only control each’s aggregated contribution to the total energy by varying β and γ, respectively. One can tailor these interactions by amplitude modulation of the input Gaussian beam using, e.g., SLMs or DMDs, varying the numerical aperture of the output fiber couplers, slightly changing the quasi-phase matching conditions, and so on.

To find the ground states of the total Hamiltonian, the SLM’s initial phase mask is prepared in small clusters with randomly chosen 0 or π phases. The resulting pump and SH waves are coupled separately into single-mode fibers, whose optical power is measured for feedback control. To minimize the total energy, we adaptively flip the spins within a randomly chosen cluster, following the standard Monte Carlo approach58. A flow chart of this procedure is shown in Fig. 4, where the spin flipping during each iteration is accepted or rejected according to a Boltzmann’s probability function \(P=\exp [-U/\tau ]\), with U = Enew − Eold being the change in energy and τ the thermal energy. To avoid trapping into a local minimum, we vary both the cluster size s and τ during iterations. It is noteworthy that this algorithm is not necessarily the most efficient, but nevertheless adequate for our current demonstrations as the first case study of this Ising platform. A machine-learning-based Monte Carlo method could be utilized in the future to speed up this optimization59.

Fig. 4: A flow chart of the adaptive feedback-control algorithm using a Monte Carlo method.
figure 4

Step 1: generate an initial random binary phase spin pattern on a spatial light modulator (SLM). Step 2: define the total energy of the system. Step 3: define the range for s and τ and run t random trials for each. Step 4: detect the pump and second harmonic (SH) powers. Step 5: find the energy difference U = Enew − Eold (where Eold is the previous minimum energy), Boltzmann's probability function \(P=\exp [-U/\tau ]\), and a random variable R [0, 1]. Step 6: check if the optimization criteria, U ≤ 0 or P > R, is met. Step 7: check the number of iterations. Step 8: if the criteria is not satisfied in Step 6 and Step 7, flip the spins within a randomly chosen cluster and update the binary phase mask on a SLM. Step 9: repeat Steps 3–8 if optimum criteria is not satisfied. Step 10: stop the feedback loop and collect the results.

Figure 5 illustrates the process of optimization for 800 × 800 spins with eight initial random phase masks. Figure 5a shows how the optical pump power is increased; thus, the decrease of total energy E to approach the ground state of the system. With α = 0, there is spontaneous symmetry breaking, as the system energy remains unchanged if all spins are flipped. As such, the feedback control will optimize the spins toward either positive or negative magnetic states with equal probability35. This is clear in Fig. 5b, where the magnetization trends both ways. For all initial phase trials, the absolute value of average magnetization can reached to  ~ 0.75.

Fig. 5: Evolution of the pump power and magnetization with only two-body Ising interactions.
figure 5

a Measured pump power and b magnetization over optimization iterations for 800 × 800 spins with α = 0, β = −1, and γ = 0.

In Fig. 6, we show the two sets of measurements (a) and (b) for 400 × 400 spins and (c) and (d) for 800 × 800 spins, respectively, with purely four-body interactions, i.e., α = 0 and β = 0. Figure 6a, c plot the SH power evolution for γ = 1, for which the system ground states correspond to the minimum SH power. In both figures, different initial spins are optimized to give similar minimum SH power, which indicates the robustness of our optimization method. For γ = 1, the system evolves into a paramagnetic-like state that minimizes the SH power in the fiber. In Fig. 6c, the values are close to the minimum detectable power of our optical sensor (~5 nW). Because of a smaller pixel size in Fig. 6c, the spin disorder is stronger to give lower SH power in Fig. 6a. In opposite, Fig. 6b, d are for γ = −1, where the ground states are obtained at the highest SH power. In this case, the system exhibits a ferromagnetic-like behavior. For 400 × 400 and 800 × 800 spins, the optimization leads to similar maximum SH power despite different initial spin conditions. The convergence is slower for the latter case, as there are four times more spins to be optimized. Overall, our system can reliably and efficiently evolve into the vicinity of its ground state.

Fig. 6: Measured second harmonic (SH) power (in log scale) evolving during the feedback-control optimization.
figure 6

a The decrease in power over iterations for 400 × 400 spins and an Ising machine with α = 0, β = 0, and γ = 1. b The increase in SH power, which corresponds to approximate the ground state of an Ising machine with α = 0, β = 0, and γ = −1. c, d Similar results but for 800 × 800 spins. Here, curves in different colors are for the results obtained from different initial random phase masks.

To further understand the optimization mechanism, we take images of the pump and SH beams at the crystal output by splitting them using flipping beam splitters, as shown in Fig. 3. Through 4F systems, the pump is imaged on a NIR camera, and the SH on a CCD camera. Figure 7a, b show the pump and SH images, respectively, under different iteration numbers as they minimize the energy of 800 × 800 spin system with α = 0, β = 1, and γ = 1. As shown, both light beams become scattering and show speckle patterns as the optimization goes. The resulting fiber-coupled SH and pump power is shown in Fig. 7c. Both decrease with the iteration numbers, dropping by orders of magnitude to minimum values after 150 iterations. It is noteworthy that the final SH power level is very close to the detection level of the sensors, which prohibits further reduction via the present feedback control.

Fig. 7: Evolution of the second harmonic (SH) and pump lights with different iteration numbers.
figure 7

a, b The resulting images of the SH and pump lights, respectively, at the crystal output upon different numbers of iterations (shown inside of the images)). The system contains 800 × 800 spins and the goal is to find the ground state of the Ising Hamiltonian with α = 0, β = 1, and γ = 1. The blue and red circles indicate the coupling areas of the SH and pump light into the single-mode fibers, respectively. The labels in each image are the corresponding iteration numbers. c The measured SH (blue dashed curve) and pump (red solid curve) power over iterations.

As seen in Eq. (10), the two-body and four-body interaction energies are dependent only on the relative alignment of the spins, but not on each’s absolute orientation. Thus, spontaneous symmetry breaking could occur during the optimization, leading to bifurcation35. To avoid this symmetry breaking, one could set a non-zero α to control the convergence direction of spin optimization. As an example, in Fig. 8, we compare the results with α = 1 in (a, b) and α = −1 in (c, d), both with β = −0.5 and γ = −1. As shown, α can indeed dictate the spin alignment to result in either positive or negative magnetization states. In both cases, starting from a rather randomized phase mask shown in the inset of Fig. 8a, c, the spins become relatively aligned to increase the SH and pump power, but magnetization can have positive or negative orientation as can be seen Fig. 8b, d. The inset of Fig. 8b, d shows the final phase mask of the optimum solution, where black and white colors represents the positive and negative orientation of the spins, respectively. Similar results are shown in Supplementary Note 3 with other input phase masks. It is noteworthy that in our setup, the computing tasks such as matrix multiplication, Fourier transformation, and four-body interactions, are realized through linear optics, nonlinear optics, and optical detection. The relaxation of the spin system to its ground state, on the other hand, is achieved through feedback control. To speed it up, field-programmable gate arrays (FPGAs) or field-programmable photonic gate arrays (FPPGAs) can be employed in the future60,61,62.

Fig. 8: Evolution of the second harmonic (SH) power, pump power, and magnetization during feedback optimization.
figure 8

a The evolution of experimentally measured SH power (blue dashed curve) and pump (red solid curve) power with different iteration numbers, set to find the ground state of the Ising machine with α = −1, β = −0.5, and γ = −1. b The evolution of magnetization. c, d Similar results but with α = 1, β = −0.5, and γ = −1. Insets show the initial and final phase masks in each case, respectively, where the black and white pixels indicates the positive and negative orientated spins, respectively.

We last consider the cases where two-body and four-body interactions contribute oppositely to the total energy of the system. For instance, the two-body interaction can be attractive but four-body be repulsive, or vice versa. Such systems can be conveniently configured by defining the pre-factors β and γ in Eq. (10). The optimization will maximize one, while minimizing the other. As an example, Fig. 9 plots the optimization trajectory for opposite two-body and four-body interactions. In Fig. 9a, β = 1, and γ = −1, so that the system energy is maximized by reducing the pump power, while increasing the SH power. Its opposite configuration is in Fig. 9b, where β = −1, and γ = 1 so that the same optimization increases the pump power, while reducing the SH power. This example suggests that the nature of two-body and four-body interactions can be conveniently maneuvered in our Ising machine, which makes it versatile for simulating various systems in solid-state physics63,64,65, chemical engineering66, and so on. This Ising machine is efficient, because it calculates the many-body interaction energy during a single pass through a nonlinear crystal, realizing simultaneously matrix multiplication, Fourier transformation, etc., of large-size data.

Fig. 9: Experimentally measured evolution of the second harmonic (SH) and pump power during feedback optimization.
figure 9

The adjustable parameters for a α = 0, β = 1, and γ = −1, and b α = 0, β = −1, and γ = 1. The SH and pump powers are shown in blue dashed curve and red solid curve, respectively.

Discussion

Our nonlinear optical Ising machine can be applied to some of the NP hard problems involving multi-body interactions, such as k-SAT problems41, and spin-glass models67. Yet, the main limitation with our current setup comes from the slow response of the SLM’s. To establish a practical advantage, we will need to replace the SLM’s with fast digital micromirrors controlled by FPGA, use all-optical feedback, or design hybrid optical-FPPGA hardwares60,61,62. Meanwhile, although the present optical Ising machine only supports two and four-body interactions, other processes of nonlinear optics, such as sum frequency, four-wave mixing, and high-order harmonic generation, can be employed to realize even higher-order interactions, whose computational complexity and intensity could quickly grow beyond the capability of existing computing platforms.

Using spatial phase modulation and SH generation, we have constructed Ising emulators with all-to-all connections and tailored chemical potential, two-body interaction, and four-body interaction. Their ground-state solutions can be effectively and reliably approximated by adaptive feedback control, whose speed is currently limited by the processing time of the SLM. A significant speedup is achievable by using ferroelectric liquid-crystal based SLMs or programmable plasmonic phase modulators68,69. At the present, the maximum number of accessible pixels is about 1 million and can be further increased by using modulators with more pixels or combining multiple modulators. The total supported spin number, on the other hand, is less in practice, due to the optical perfections. Although this study considers only SH generation, it can be straightforwardly extended to other nonlinear processes, such as sum-frequency generation, difference-frequency generation, four-wave mixing, for other interesting Ising machines54,55,56,57,70. Such nonlinear optical realizations of Ising machines could contribute as supplements for big data optimization and analyses that remain challenging for classical supercomputers or forthcoming quantum machines but with a limited number of qubits.