AI on Bitcoin
Artificial intelligence, especially in the form of machine learning, has recently seen tremendous advances, with applications ranging from face recognition to autonomous vehicles. We propose to combine AI with the Bitcoin blockchain, for many salient advantages unachievable otherwise¹:
- Open and transparent: both the code and data on the blockchain are public and can be verified by anyone and thus be trusted.
- Collaborative datasets: everyone can contribute data and access the published data, compared to traditional siloed datasets.
Not only can Bitcoin maintain the datasets on chain for input into AIs, it can also host an AI algorithm itself to work with these datasets².
We have implemented a basic building block of machine learning, Perceptron, and demonstrated the enormous potential of building AI on Bitcoin.
Similar to neurons as the building blocks of neural networks, perceptrons are its equivalent of Artificial Neural Networks (ANNs). A perceptron is a single layer neural network, looking like the following
It consumes multiples inputs, weights them, sum it, feeds it into a step function (shown below) and produces one binary output (just 0 or 1). Perceptron is usually used to classify data into two categories.
A Gender Classification Perceptron
We use perceptron to solve a simple classification problem. The inputs are the heights and weights of multiple people, the outputs are their genders.
We aim to fit a boundary line that separates all the male samples from the female ones. Perceptron is a great way to find the line when samples become humongous.
We have implemented such a perceptron as a stateful contract. Its state consists of all the weights and the bias (w0 in the diagram). Initially, they are assigned some random values, which are then adjusted every time a transaction updates the state. The learning phase runs till the it converges.
The final boundary found by our perceptron looks like this.
Once we have built perceptron as basic blocks, more advanced and practical ANNs can be built atop Bitcoin, opening up endless opportunities.