This project demonstrates the capabilities of a fully on-chain Large Language Model (LLM) implemented on the Internet Computer Protocol (ICP) canister system. The LLM is specifically trained to understand and interact with chess positions, showcasing the potential for complex AI models to run directly on blockchain infrastructure.
- On-Chain LLM: A compressed LLM capable of running inference directly within an ICP canister.
- Chess Understanding: The model can interpret chess positions and generate legal moves.
- Efficient Compression: Advanced techniques to fit a capable LLM within blockchain constraints.
- C++ Backend: High-performance backend code for model execution.
- Base Model: LLaMA2 (compressed variant)
- Training Data: Synthesized and cleaned chess data
- Environment Simulation: Custom chess environment for model training
- Backend Language: C++
- Deployment: ICP canister
- Input Format: Forsyth–Edwards Notation (FEN) for chess positions
- Input: The system accepts a chess position in FEN format.
- Processing: The on-chain LLM interprets the position and generates possible moves.
- Output: The system returns a list of legal moves for the current position.
Input:
rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w
Output:
(
variant {
Ok = record {
inference = " g1h3 g1f3 b1c3 b1a3 h2h3 g2g3 f2f3 e2e3 d2d3 c2c3\n<s>\n";
}
},
)
- The model uses a random number generator (RNG) seed for deterministic behavior.
- Inference time may vary based on the complexity of the chess position.
- The model is optimized for chess and may not perform well on other tasks.
- The size of the model is constrained by ICP canister limitations.
- Expand the model to handle more complex chess scenarios (e.g., endgame positions).
- Optimize inference speed for quicker response times.
- Explore integration with on-chain chess games or tournaments.
We welcome contributions to this project! Please see our contributing guidelines for more information.
@mauriciocarpio