Example of Using Burn Deep Learning Framework on Internet Computer: LSTM ICP Price Prediction

Introduction

Hello everyone!
I am pleased to share an open source example project showing how to build an LSTM price prediction model on an Internet Computer (IC) using Burn(burn - Rust), a deep learning framework for Rust.

This project is a proof-of-concept (POC) that implements an LSTM-based Canister for time series price forecasting (e.g., financial data). As a subfield of machine learning, deep learning has great potential for IC applications, and I hope this example will help other developers explore decentralized deep learning development.
The project code is open source, trials, feedback and contributions are welcome!

Project Background

Internet Computer provides a powerful decentralized computing platform, while Burn is a high-performance Rust deep learning framework that supports neural networks and tensor operations. Combining the two, we can run deep learning models on ICs for decentralized prediction tasks. Machine learning (including deep learning) has a wide range of applications in finance, IoT, etc.

This project demonstrates how to implement deep learning in an IC environment through a simple price prediction task.
Key issues addressed in this project include:

  • Integrating Burn’s deep learning capabilities in IC Canister.
  • Using LSTM to process time series data.
  • Providing true random numbers to initialize model weights using the IC raw_rand interface.

Project Features

This project implements a Price Forecast Canister with the following functionality:

  • Incremental training: the train method supports multiple calls with 5 epochs of training each time (note that the training is not actually stored in memory, and the results are not really saved each time).

  • Prediction: The predict method uses 50 locally saved data, the 2024 ICP price history from Binance, and a sequence of 6 feature inputs to generate a closing price prediction for the next time step.

According to the cycles consumption of the local test, each call to the training method consumes about 8B cycels, while the call to the predict method consumes almost nothing.

Precautions for use

This is just a POC project with some imperfections

After the deployment is complete, you must first upload the local file /assets/icp_history_price_2024.json from the webpage, otherwise there is no data to support the training or prediction.

After uploading, you must initialize the model with one round of training, otherwise you can’t make predictions.

dfx canister call ic_burn_backend train '(5:nat64)'
dfx canister call ic_burn_backend predict

Finally

ic-burn (GitHub - LintDAO/ic-burn) aims to provide a practical starting point for deep learning development on IC.

TallyLint DAO is now renamed Lint DAO, and we are starting to build a new marketplace on IC based on Burn.
Our team consists of a front-end developer and a back-end developer, but to push ic-burn to a wider community and explore greater potential, we need a core partner to join us.
Wanted: Operations Co-Founder (Community & Operations Orientation)
Looking for a passionate co-founder to drive ic-burn from POC to full-fledged project.
If anyone is interested, please DM me at discord@cryptoworkers.

1 Like