AI player on ICP - IChess


Overview:
The On-Chain Chess LLM project showcases the capability of running a fully functional Large Language Model (LLM) directly on the Internet Computer Protocol (ICP) canister system. This project aims to demonstrate the potential of blockchain-based AI by focusing on chess, where the LLM interprets chess positions and generates legal moves. The project is tailored for chess enthusiasts, developers interested in AI and blockchain integration, and anyone curious about the application of advanced AI models in decentralized environments.

Web3 vs. Web2:|
While there are numerous chess engines and AI models available on traditional platforms (Web2), this project stands out by being fully on-chain, which ensures:
• Transparency: All computations are visible and verifiable by any participant.
• Security: Running the LLM on-chain reduces the risk of tampering or unauthorized access.
• Decentralization: Unlike centralized systems, there’s no single point of failure, enhancing reliability and trustworthiness.

Technical Stack:
• Base Model: LLaMA2 (compressed variant)
• Training Data: Synthesized and cleaned chess data
• Environment Simulation: Custom-built chess environment for model training
• Backend Language: C++
• Deployment: ICP canister system
• Input Format: Forsyth–Edwards Notation (FEN) for chess positions

Architecture & Design Decisions:
• The LLM has been compressed to fit within the storage and computation limits of an ICP canister.
• A high-performance C++ backend was chosen for model execution to ensure that the LLM operates efficiently within the blockchain’s constraints.
•The design prioritizes minimal resource usage while maintaining accurate chess move generation.

Key ICP Features Utilized:
• Scalability: The ICP’s ability to handle multiple requests efficiently allows the LLM to process chess positions at scale.
• Security: The deterministic nature of the ICP ensures that AI inferences are consistent and tamperproof.
• Interoperability: The ICP allows seamless integration with other on-chain services, paving the way for potential expansions like on-chain chess tournaments.

Resources:
Frontend Canister
Backend Canister

Project Repository
ICP LLM Project
Discord
X
Telegram Channel
TMA

Check our additional show cases on Forum:

Data Portfolio app

DPOS:

18 Likes

Congrats!

Very interesting and innovative work to use a specialized on-chain LLM to predict the chess moves.

I have a few questions:

  • How did you generate the training data?
  • Did you use the 15M parameter model?
  • Do you feel you have sufficient training data for a bigger model?
4 Likes

Hi!, It was indeed a really fun project, we trained for a couple of hours with a set of games that a chess simulator created , we used the 15M model. And yes we have sufficiend data for bigger model but we had only around 24 hours for the hackaton so we had no more time to test extra things.

6 Likes

Wow so good inovation come from Hackaton and only 24 hours, I think you’re finished the model need one 3-4 days. Amazing #ICP now already trully only one running AI onchain
please notice this guys @domwoe @jennifertran
maybe can help another innovation AI for ICP after DecideAI

3 Likes

@laughtt ,
that is very impressive you did this all during a hackathon!

Feel free to ping me for additional discussion. I have a fine-tuning pipeline for that model as well, and we can compare notes.

3 Likes

Wow with fine-tuning pipeline I think we can leverage new innovation AI again for ICP :rofl:

Wow, is great i text you in X

1 Like

Not yet fine-tuning on ICP, although that is also a goal. We train/fine-tune off chain right now.

I am looking into GitHub - karpathy/llm.c: LLM training in simple, raw C/CUDA , but you really need a GPU for that.

That llm.c can definitely be used to train your chess game.

2 Likes