A simple browser based recommendation system

(Updated: 2018-01-01)

Imagine a recommendation system that runs entirely on the browser – it observes your preferences and likes and recommends items to you without sharing your data or preferences to anyone. As Artifical Intelligence becomes more useful yet invasive, it’s increasingly becoming difficult to gain the benefits of AI while retaining personal privacy and anonymity. This project is a simple proof of concept on creating a recommendation system that runs entirely on a browser.

The technological breakthrough

Web Assembly (wasm) is a fairly new technology that allows web browsers to run code at near native speeds. WASM is compiled code (usually C/C++) that can run on a browser along side javascript. More interestingly the ability to run intensive code in a low-resource environment such as a browser promises to usher in a wave of powerful and portable applications – in theory an app can created once and it run on any browser on any device on any OS!

It keeps getting better

The ability to run server logic right on the user’s device can meanreducing server costs, decreasing latency, and most importantly giving the user more control of her data. A great and much more powerful project for machine learning that aims to protect user data while protecting a company’s proprietory model is OpenMined.

Future enhancements

GPU: This project currently doesn’t take advantage of the web-gl GPU libraries available. There is significant room to improve calculations by running them in parallel on the GPU.

Neural Networks: I would like to extend this project to be a neural network library that can train on simple datasets such as CIFAR-10 directly on the browser.

Federated Learning I would like to explore the possibility of training somewhat larger neural networks through a distributed network of simple devices. This could be a network that trains on web browsers running on mobile devices and general computers.

Homomorphic Encryption: Traning on user data can reveal sensitive information about users. I would like to explore training neural network on encrypted data.

The demo:

In this demo I’m using a dataset that contains 100,000 movie ratings of 9,000 movies rated by 700 users. You may enter a user id which will be an integer between 1 ~ 650. A movie id (integer) will be returned with a score (a double between 0.0 - 5.0).

The method used for recommending is “collaborative filtering” where users who share similar likes (ratings) for movies will receive similar ratings to each other. The idea is that if another user who’s similar as me likes a movie I haven’t watched chances are I’ll also like the same movie.