Sentence guessing game based on ML and coSNARKs
Note
This repo is a single-machine CLI demo of the Mind Reader game. The actual game should be deployed on a coSNARK MPC network such as TACEO.
This project originates from the idea that we can create a fun game for users to guess a prompt that generates a target image, inspired by Unveiling Emotions. However, due to the limitations of zkML to prove large generative models, we have to simplify the game to a mind-reading game, which is to guess the sentence that the creator is thinking of.
The CLI app is a simple node.js app that allows you to play the Mind Reader game. It encodes the solution and guesses into embeddings using the Universal Sentence Encoder, and then proves the solution and guess using the Codemaker and Guesser circuits respectively. The game stops when the guess is close enough to the solution (cosine similarity > 0.9).
The Codemaker circuit encodes the solution sentence into a hash and computes the squared norm of the sentence.
The Guesser circuit encodes the guess sentence into a hash and computes the dot product of the guess with the solution.
- Clone the repo
git clone https://github.com/BonAppResearch/mind-reader-cli.git
- Install dependencies
bash setup.sh
npm install
- Start the game
npm start