Energy-Efficient Sampling Using Stochastic Magnetic Tunnel Junctions

Alder, Nicolas, Kajale, Shivam Nitin, Tunsiricharoengul, Milin, Sarkar, Deblina, Herbrich, Ralf

arXiv.org Machine Learning 

We introduce an energy-efficient algorithm for uniform Float16 sampling, utilizing a roomtemperature stochastic magnetic tunnel junction device to generate truly random floating-point numbers. By avoiding expensive symbolic computation and mapping physical phenomena directly to the statistical properties of the floating-point format and uniform distribution, our approach achieves a higher level of energy efficiency than the state-of-the-art Mersenne-Twister algorithm by a minimum factor of 9721 and an improvement factor of 5649 compared to the more energy-efficient PCG algorithm. Building on this sampling technique and hardware framework, we decompose arbitrary distributions into many non-overlapping approximative uniform distributions along with convolution and prior-likelihood operations, which allows us to sample from any 1D distribution without closed-form solutions. We provide measurements of the potential accumulated approximation errors, demonstrating the effectiveness of our method. This not only increases the cost of products, but also presents obstacles in addressing climate change. Traditional AI methods like deep learning lack the ability to quantify uncertainties, which is crucial to address issues such as hallucinations or ensuring safety in critical tasks. Probabilistic machine learning, while providing a theoretical framework for achieving muchneeded uncertainty quantification, also suffers from high energy consumption and is unviable on a truly large scale due to insufficient computational resources (Izmailov et al., 2021). At the heart of probabilistic machine learning and Bayesian inference is Markov Chain Monte Carlo (MCMC) sampling (Kass et al., 1998; Murphy, 2012; Hoffman & Gelman, 2014). Although effective in generating samples from complex distributions, MCMC is known for its substantial computational and energy requirements, making it unsuitable for large-scale deployment for applications such as Bayesian neural networks (Izmailov et al., 2021). In general, random number generation is an expensive task that is required in many machine learning algorithms. To address these challenges, this paper proposes a novel hardware framework aimed at improving energy efficiency, in particular tailored for probabilistic machine learning methods. Our framework builds on uniform floating-point format sampling utilizing stochastically switching magnetic tunnel junction (s-MTJ) devices as a foundation, achieving significant gains in both computational resources and energy consumption compared to current pseudorandom number generators. In contrast to existing generators, this device-focused strategy not only enhances sampling efficiency but also incorporates genuine randomness originating from the thermal noise in our devices.