What Is Stochastic Computing and How It Works

Stochastic computing is an unconventional processing paradigm that represents continuous numerical values as probabilities within randomized binary bitstreams. This article explains the core principles of stochastic computing, details how continuous probabilities are encoded using standard binary elements, demonstrates how simple logic gates execute complex mathematical operations, and highlights the primary benefits and limitations of this architecture.

Understanding Stochastic Computing

Traditional digital computing relies on positional binary notation, where each bit in a word carries a specific weight (\(2^0, 2^1, 2^2\), etc.) based on its position. In contrast, stochastic computing uses an unweighted representation. Numerical values are encoded by the statistical distribution of bits in a stream over time.

Instead of processing a single fixed-width word through complex arithmetic logic units (ALUs), stochastic systems stream sequences of random bits where the fraction of logic 1s relative to the total number of bits reflects a specific continuous value.

Encoding Probabilities into Bitstreams

Stochastic computing bridges continuous values and binary logic through two primary encoding formats:

1. Unipolar Format

In unipolar representation, a continuous real number \(x\) in the interval \([0, 1]\) is represented by the probability \(P(X = 1) = x\).

2. Bipolar Format

To represent negative numbers, stochastic computing uses the bipolar format, which maps the interval \([-1, 1]\) to the probability range \([0, 1]\) using the transformation:

\[x = 2 \cdot P(X = 1) - 1\]

Generation via Stochastic Number Generators (SNGs)

To convert conventional binary numbers into stochastic bitstreams, systems use Stochastic Number Generators (SNGs). An SNG typically pairs a pseudo-random number generator, such as a Linear Feedback Shift Register (LFSR), with a standard binary comparator. If the random number generated is less than the input binary value, the comparator outputs a 1; otherwise, it outputs a 0.

Mathematical Operations with Basic Logic Gates

Because values are represented as statistical probabilities, complex arithmetic can be performed with minimal hardware:

Advantages of Stochastic Computing

Trade-offs and Challenges

The primary limitation of stochastic computing is latency. To double the precision of a stochastic computation, the bitstream length must increase exponentially (\(O(2^n)\) bits for \(n\) bits of precision). Consequently, stochastic computing is not suited for high-precision general computing, but it excels in approximate computing domains such as image processing, artificial neural networks, and error-resilient signal processing.