## Abstract

Conventional computers operate deterministically using strings of zeros and ones called bits to represent information in binary code. Despite the evolution of conventional computers into sophisticated machines, there are many classes of problems that they cannot efficiently address, including inference, invertible logic, sampling and optimization, leading to considerable interest in alternative computing schemes. Quantum computing, which uses qubits to represent a superposition of 0 and 1, is expected to perform these tasks efficiently^{1,2,3}. However, decoherence and the current requirement for cryogenic operation^{4}, as well as the limited many-body interactions that can be implemented, pose considerable challenges. Probabilistic computing^{1,5,6,7} is another unconventional computation scheme that shares similar concepts with quantum computing but is not limited by the above challenges. The key role is played by a probabilistic bit (a p-bit)—a robust, classical entity fluctuating in time between 0 and 1, which interacts with other p-bits in the same system using principles inspired by neural networks^{8}. Here we present a proof-of-concept experiment for probabilistic computing using spintronics technology, and demonstrate integer factorization, an illustrative example of the optimization class of problems addressed by adiabatic^{9} and gated^{2} quantum computing. Nanoscale magnetic tunnel junctions showing stochastic behaviour are developed by modifying market-ready magnetoresistive random-access memory technology^{10,11} and are used to implement three-terminal p-bits that operate at room temperature. The p-bits are electrically connected to form a functional asynchronous network, to which a modified adiabatic quantum computing algorithm that implements three- and four-body interactions is applied. Factorization of integers up to 945 is demonstrated with this rudimentary asynchronous probabilistic computer using eight correlated p-bits, and the results show good agreement with theoretical predictions, thus providing a potentially scalable hardware approach to the difficult problems of optimization and sampling.

## Access options

Subscribe to Journal

Get full journal access for 1 year

$199.00

only $3.90 per issue

All prices are NET prices.

VAT will be added later in the checkout.

Rent or Buy article

Get time limited or full article access on ReadCube.

from$8.99

All prices are NET prices.

## Data availability

The datasets generated and analysed during this study are available from the corresponding authors on reasonable request.

## References

- 1.
Feynman, R. P. Simulating physics with computers.

*Int. J. Theor. Phys*.**21**, 467–488 (1982). - 2.
Shor, P. Polynomial-time algorithms for prime factorization and discrete logarithms on a quantum computer.

*SIAM J. Comput*.**26**, 1484–1509 (1997). - 3.
Vandersypen, L. M. K. et al. Experimental realization of Shor’s quantum factoring algorithm using nuclear magnetic resonance.

*Nature***414**, 883–887 (2001). - 4.
Preskill, J. Quantum computing in the NISQ era and beyond.

*Quantum***2**, 79 (2018). - 5.
Kirkpatrick, S., Gelatt, C. D. & Vecchi, M. P. Optimization by simulated annealing.

*Science***220**, 671–680 (1983). - 6.
Geman, S. & Geman, D. Stochastic relaxation, Gibbs distributions, and the Bayesian restoration of images.

*IEEE Trans. Pattern Anal. Mach. Intell*.**6**, 721–741 (1984). - 7.
Sutton. B., Camsari, K. Y., Behtash, B.-A. & Datta, S. Intrinsic optimization using stochastic nanomagnets.

*Sci. Rep*.**7**, 44370 (2017). - 8.
Camsari, K. Y., Faria, R., Sutton, B. M. & Datta, S. Stochastic p-bits for invertible logic.

*Phys. Rev. X***7**, 031014 (2017). - 9.
Albash, T. & Lidar, D. A. Adiabatic quantum computation.

*Rev. Mod. Phys*.**90**, 015002 (2018). - 10.
Ikeda, S. et al. A perpendicular anisotropy CoFeB–MgO magnetic tunnel junction.

*Nat. Mater*.**9**, 721–724 (2010). - 11.
Kent, A. D. & Worledge, D. C. A new spin on magnetic memories.

*Nat. Nanotechnol*.**10**, 187–191 (2015). - 12.
Peng, X. et al. Quantum adiabatic algorithm for factorization and its experimental implementation.

*Phys. Rev. Lett*.**101**, 220405 (2008). - 13.
Biamonte, J. Nonperturbative

*k*-body to two-body commuting conversion Hamiltonians and embedding problem instances into Ising spins.*Phys. Rev. A***77**, 052331 (2008). - 14.
Jiang, S., Britt, K. A., Humble, T. S. & Kais, S. Quantum annealing for prime factorization.

*Sci. Rep*.**8**, 17667 (2018). - 15.
Ackley, D. H., Hinton, G. E. & Seinowski, T. J. A learning algorithm for Boltzmann machines.

*Cogn. Sci*.**9**, 147–169 (1985). - 16.
Camsari, K. Y., Salahuddin, S. & Datta, S. Implementing p-bits with embedded MTJ.

*IEEE Electron Device Lett*.**38**, 1767–1770 (2017). - 17.
Fukushima, A. et al. Spin dice: a scalable truly random number generator based on spintronics.

*Appl. Phys. Express***7**, 083001 (2014). - 18.
Mizrahi, A. et al. Neural-like computing with populations of superparamagnetic basis functions.

*Nat. Commun*.**9**, 1533 (2018). - 19.
Julliere, M. Tunneling between ferromagnetic films.

*Phys. Lett. A***54**, 225–226 (1975). - 20.
Brown, W. F. Thermal fluctuations of a single-domain particle.

*Phys. Rev*.**130**, 1677–1686 (1963). - 21.
Chaves-O’Flynn, G. D., Wolf, G., Sun, J. Z. & Kent, A. D. Thermal stability of magnetic states in circular thin-film nanomagnets with large perpendicular magnetic anisotropy.

*Phys. Rev. Appl*.**4**, 024010 (2015). - 22.
Slonczewski, J. C. Current-driven excitation of magnetic multilayers.

*J. Magn. Magn. Mater*.**159**, L1–L7 (1996). - 23.
Berger, L. Emission of spin waves by a magnetic multilayer traversed by a current.

*Phys. Rev. B***54**, 9353–9358 (1996). - 24.
Brataas, A., Kent, A. D. & Ohno, H. Current-induced torques in magnetic materials.

*Nat. Mater*.**11**, 372–381 (2012). - 25.
Pervaiz, A. Z., Ghantasala, L. A., Camsari, K. Y. & Datta, S. Hardware emulation of stochastic p-bits for invertible logic.

*Sci. Rep*.**7**, 10994 (2017). - 26.
Camsari, K. Y., Chowdhury, S. & Datta, S. Scaled quantum circuits emulated with room temperature p-bits. Preprint at https://arxiv.org/abs/1810.07144 2018).

- 27.
Kleinjung, T. et al. in

*Advances in Cryptology – CRYPTO 2010*(ed. Rabin, T.) 333–350 (Springer, 2010). - 28.
Lee, Y. K. et al. Embedded STT-MRAM in 28-nm FDSOI logic process for industrial MCU/IoT application. In

*2018 IEEE Symposium on VLSI Technology*181–182 (IEEE, 2018). - 29.
Roberts, G. O. & Sahu, S. K. Updating schemes, correlation structure, blocking and parametrization for the Gibbs sampler.

*J. R. Soc. Ser. B***59**, 291–317 (1997). - 30.
Endo, M. et al. Electric field effects on thickness-dependent magnetic anisotropy of sputtered MgO/CoFeB/Ta structures.

*Appl. Phys. Lett*.**96**, 212503 (2010). - 31.
Enobio, E. C. I., Bersweiler, M., Sato, H., Fukami, S. & Ohno, H. Evaluation of energy barrier of CoFeB/MgO magnetic tunnel junctions with perpendicular easy axis using retention time measurement.

*Jpn. J. Appl. Phys*.**57**, 04FN08 (2018). - 32.
Lucas, A. Ising formulations of many NP problems.

*Front. Phys*.**2**, 5 (2014). - 33.
Xu, N. et al. Quantum factorization of 143 on a dipolar-coupling nuclear magnetic resonance system.

*Phys. Rev. Lett*.**108**, 130501 (2012). - 34.
Burges, C. J. C.

*Factoring As Optimization*. Report No. MSR-TR-2002-83 (Microsoft Research Lab, 2002). - 35.
Henelius, P. & Girvin, S. A statistical mechanics approach to the factorization problem. Preprint at https://arxiv.org/abs/1102.1296 (2011).

- 36.
Dridi, R. & Alghassi, H. Prime factorization using quantum annealing and computational algebraic geometry.

*Sci. Rep*.**7**, 43048 (2017); erratum**7**, 44963 (2017). - 37.
Pervaiz, A. Z., Sutton, B. M., Ghantasala, L. A. & Camsari, K. Y. Weighted p-bits for FPGA implementation of probabilistic circuits.

*IEEE Trans. Neural Netw. Learn. Syst*.**30**, 1920–1926 (2018). - 38.
Zand, R., Camsari, K. Y., Datta, S. & Demara, R. F. Composable probabilistic inference networks using MRAM-based stochastic neurons.

*ACM J. Emerg. Technol*.**15**, 17 (2019). - 39.
Mathew, S. K. et al. μRNG: a 300–950 mV, 323 Gbps/W all-digital full-entropy true random number generator in 14 nm FinFET CMOS.

*IEEE J. Solid-State Circuits***51**, 1695–1704 (2016). - 40.
Zhao, W. & Yu, C. New generation of predictive technology model for sub-45 nm early design exploration.

*IEEE Trans. Electron Dev*.**53**, 2816–2823 (2006). - 41.
Datta, D. et al. Voltage asymmetry of spin-transfer torques.

*IEEE Trans. Nanotechnol*.**11**, 261–272 (2012). - 42.
Park, C. et al. Low RA magnetic junction arrays in conjunction with low switching current and high breakdown voltage for STT-MRAM at 10 nm and beyond. In

*2018 IEEE Symposium on VLSI Technology*185–186 (IEEE, 2018).

## Acknowledgements

We thank H. Sato, M. Bersweiler, T. Hirata, H. Iwanuma, K. Goto, C. Igarashi, I. Morita, R. Ono and M. Musya for technical support. We thank O. Hassan and S. Chowdhury for their help with the Methods sections comparing CMOS alternatives and quantum computing, respectively. A portion of this work was supported by ImPACT Program of CSTI, JSPS KAKENHI grant numbers 17H06093 and 19J12206, Cooperative Research Projects of RIEC, and ASCENT, one of six centres in JUMP, an SRC program sponsored by DARPA. W.A.B. acknowledges JST-OPERA.

## Author information

### Author notes

### Affiliations

### Contributions

S.F., K.Y.C., H.O. and S.D. planned the study. W.A.B. and S.F. prepared and characterized the MTJ devices. A.Z.P., K.Y.C. and S.D. developed the algorithm and experimental setup. A.Z.P. and K.Y.C. conducted factorization experiment and collected results. All authors contributed to the writing of the manuscript. All authors discussed the results.

### Corresponding authors

Correspondence to Shunsuke Fukami or Kerem Y. Camsari.

## Ethics declarations

### Competing interests

The authors declare no competing interests.

## Additional information

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

**Peer review information** *Nature* thanks Kyung-Jin Lee, Dmitri Nikonov and the other, anonymous, reviewer(s) for their contribution to the peer review of this work.

## Extended data figures and tables

### Extended Data Fig. 1 p-bit construction.

**a**, A diagram of the ideal response of a stochastic MTJ as used in this work and the parameters used to characterize the MTJ. **b**, The measured drain current *I*_{DS} as a function of *V*_{IN} of a 2N7000 NMOS transistor used in our p-bit demonstration.

### Extended Data Fig. 2 Block diagram of an asynchronous p-circuit.

A microcontroller reads the outputs voltages *V*_{OUT} of all p-bits and computes the synaptic weights, which are then converted to the analogue input voltages *V*_{IN} for each p-bit, using a DAC that communicates with the microcontroller.

### Extended Data Fig. 3 Experimentally observed time snapshots.

**a**–**c**, Experimentally observed time snapshots of the four p-bits used to factorize 35 (**a**, **b**). These snapshots are combined to create *x* and *y* (**c**), which fluctuate between 7 × 5 and 5 × 7.

### Extended Data Fig. 4 Calibrating the experimental system.

Calibrating a reference state using synaptic weights. **a**, The experimentally observed time-averaged output of six p-bits versus applied inputs (which are misaligned). **b**, The output is corrected using synaptic biases leading to the reference state shown. Each data point in **a** and **b** are taken as an average over a time window of 15 s with 2,000 or more sampling points.

### Extended Data Fig. 5 Comparison between the MTJ- and CMOS-based energy per random bit and cell area.

**a**, An MTJ-based p-bit simulated with the stochastic LLG model (s-LLG, dotted box). **b**, A 32-bit LFSR. The look-up table (LUT) and the digital comparator of the CMOS p-bit are not included in the comparison. INV, inverter; DFF, D-type flip flop.

### Extended Data Fig. 6 Computing with p-bits versus AQC.

**a**, A representation of how an array of six Ising spins in a qubit array can be replicated with an array of p-bits. **b**, A comparison of both approaches for factoring 161 = 23 × 7. For a system of six Ising spins, there are 64 states. At higher magnetic fields (*Γ*_{X} = 0.5) both systems are ‘disordered’ and the correct peak is not pronounced. At lower magnetic field (*Γ*_{X} = 0.1) the correct peaks emerge with a high probability. The states (*y*_{i}, *x*_{i}) have been converted to binary variables *s*_{i} from the bipolar variables *m*_{i} by defining *s*_{i} = (*m*_{i} + 1)/2 and the states [*y*_{2} *y*_{1} *x*_{4} *x*_{3} *x*_{2} *x*_{1}] are expressed in decimal on the *x* axis.

### Extended Data Fig. 7 Simulation versus experiment.

**a**–**d**, We simulate the ideal experiment when all p-bits are perfectly aligned (**a**), using an idealized p-bit model which produces the results shown in **c**. Each data point is taken as an average over a time window of 15 s with 2,000 or more sampling points. The presence of device variations leads to a non-ideal system of misaligned p-bits (**b**), which is corrected using synaptic biases, allowing the experiment to approach the correct results (**d**). The time-averaged statistics in **b** are collected over a time window of 15 s with 2,000 or more sampling points.

### Extended Data Fig. 8 Simulation of variations of *τ*_{N}.

The *τ* of six p-bits is varied from a minimum value of *τ*_{Ν} to a maximum value of 4*τ*_{Ν}. Variations between p-bits do not affect system operation providing that *τ*_{inter} = *τ*_{N}.

### Extended Data Fig. 9 Simulations of variations of MTJ parameters.

**a**–**c**, The variation of MTJ parameters results in the misalignment of the average responses of the p-bits (**a**), which results in a biased reference state (**b**). When such a system is used for factorizing 161 the observed results are incorrect (**c**). **d**–**f**, The shifts in the average responses are corrected using synaptic biases (**d**), which correct the reference state (**e**) and factorization results (**f**).

### Extended Data Fig. 10 Invertible AND gate operation.

**a**, **b**, Time snapshot for the direct mode of operation when the inputs *x*_{2} and *x*_{1} have both been pinned to 1 (**a**); the statistics collected for 60 s (**b**). **c**, **d**, Time snapshot for the p-bits operating the AND gate in inverted mode when the output *y*_{1} is pinned to 0 (**c**); the statistics collected for 60 s (**d**). **e**, **f**, Time snapshot for the p-bits operating the AND gate in floating mode (**e**); the statistics collected for 60 s (**f**). All statistics shown are collected over a time window of 60 s with 2,000 or more sampling points.

## Rights and permissions

## About this article

#### Received

#### Accepted

#### Published

#### Issue Date

#### DOI

## Comments

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