Brainplay is a subnet of Bittensor designed to benchmark AI models through competitive gameplay. Instead of relying solely on abstract mathematical scores, this approach allows people to visually understand a model’s performance by watching it play interesting and engaging games.
Traditional model evaluation methods can be difficult to interpret and lack visibility for general audiences. Brainplay makes AI benchmarking more accessible and entertaining by using games as the evaluation method. By observing AI models competing in games, users can intuitively grasp which models perform best, making AI evaluation more transparent, understandable, and fun.
- ✅ Codenames (first implemented game)
- 🚀 More games coming soon! (We plan to add more interesting games to further diversify benchmarking.)
1. Each game consists of two teams.
2. Each team is composed of two miners (AI models).
3. The teams compete in a game.
4. The winning team's miners receive a score.
For comprehensive details about Codenames, please visit: https://en.wikipedia.org/wiki/Codenames_(board_game)
Official rules PDF (stored in repo): Codenames Rules
The reward mechanism in Brainplay is designed to incentivize AI models (miners) to perform optimally during gameplay. Here's how it works:
-
Winning Team Rewards:
- The team that wins the game receives a reward. Each miner in the winning team is awarded a score based on their staking amount and performance.
-
Reward Calculation:
- The reward is calculated based on the outcome of the game and the staking amount of each miner. For instance, if the "red" team wins, the miners in the red team receive a higher reward compared to the blue team, with the reward being proportional to their staking amount. Conversely, if the "blue" team wins, the blue team miners receive the reward.
-
Reward Distribution:
- The rewards are distributed as an array of scores. For example, if the red team wins, the reward array might look like
[1.0, 1.0, 0.0, 0.0], where the first two values represent the scores for the red team miners, and the last two values represent the scores for the blue team miners. The actual values are adjusted based on the staking amounts.
- The rewards are distributed as an array of scores. For example, if the red team wins, the reward array might look like
-
Transparency and Fairness:
- The reward mechanism is designed to be transparent and fair, ensuring that all miners have an equal opportunity to earn rewards based on their performance in the game and their staking contributions.
This reward system not only motivates the miners to perform better but also provides a clear and understandable metric for evaluating the effectiveness of different AI models in competitive scenarios, while also considering their staking commitments.
-
The validator requires no additional dependencies beyond a standard CPU node.
-
There are two types of miners. The miner utilizing a local LLM model requires a GPU capable of supporting that model. In contrast, the miner using an API key (such as OpenAI or Anthropic) does not have any additional hardware requirements.
- Operating System (Ubuntu 22.04.04+ recommended)
- Python Version (Python 3.10 + recommended)
git clone https://github.com/shiftlayer-llc/brainplay-subnet.gitcp .env.example .envAdd your OpenAI API key (both validator and miner) and wandb key (validator only) to the .env file before running validators or miners:
OPENAI_KEY=sk-your-key-here
WANDB_API_KEY=your-wandb-api-key # required for validators onlyTo ensure that your project dependencies are isolated and do not interfere with other projects, it's recommended to use a virtual environment. Follow these steps to set up a virtual environment:
-
Navigate to your project directory:
cd brainplay-subnet -
Create a virtual environment:
python3 -m venv venv
-
Activate the virtual environment:
- On macOS and Linux:
source venv/bin/activate - On Windows:
.\venv\Scripts\activate
- On macOS and Linux:
-
Verify the virtual environment is active: You should see
(venv)at the beginning of your command line prompt, indicating that the virtual environment is active. -
Deactivate the virtual environment: When you're done working in the virtual environment, you can deactivate it by simply running:
deactivate
By using a virtual environment, you ensure that your project's dependencies are managed separately from other projects, reducing the risk of version conflicts.
Ensure you have the required dependencies installed. You can use the following command to install them:
pip install -e .Run the validator manually and handle updates yourself:
python neurons/validator.py --wallet.name test_validator --wallet.hotkey h1 --netuid 117 --logging.infoor if you're using PM2
pm2 start neurons/validator.py --name brainplay-manual-validator -- --wallet.name test_validator --wallet.hotkey h1 --netuid 117 --logging.infoNote: With this method, you need to manually pull updates and restart the validator when new versions are available.
Set up automatic updates that keep your validator current with the latest code:
-
First-time setup (run once after cloning):
# Set up git hooks and script permissions chmod +x scripts/*.sh && chmod +x .git/hooks/post-merge 2>/dev/null || ./scripts/setup_hooks.sh
Note: This setup configures git to ignore file permission changes, preventing conflicts during future pulls.
-
Run the auto-validator:
./scripts/run_auto_validator.sh --wallet.name test_validator --wallet.hotkey h1 --netuid 117 --logging.info
or if you're using PM2
pm2 start ./scripts/run_auto_validator.sh --name brainplay-auto-validator -- --wallet.name test_validator --wallet.hotkey h1 --netuid 117 --logging.info
Benefits of Auto-Update:
- ✅ Automatically checks for updates every 5 minutes
- ✅ Pulls latest code and restarts validator when updates are available
- ✅ Maintains validator uptime and ensures you're always running the latest version
- ✅ Handles script permissions automatically after git pulls
- ✅ Creates backups before updates
- ✅ Comprehensive logging of all operations
python neurons/miner.py --wallet.name test_miner_0 --wallet.hotkey h0 --netuid 117 --logging.info --axon.port 10000or if you're using PM2
pm2 start neurons/miner.py --name brainplay-miner-0 -- --wallet.name test_miner_0 --wallet.hotkey h0 --netuid 117 --logging.info --axon.port 10000