A comprehensive guide to setting up your environment, pulling models, training improvements with RL, and deploying to Chutes for rewards.
Prerequisites
Before you begin, ensure you have:
- A Linux-based system (Ubuntu 20.04+ recommended)
- NVIDIA GPU with CUDA support (for training)
- At least 32GB RAM
- Python 3.10 or higher
- Basic familiarity with machine learning concepts
Step 1: Install the UV Package Manager
Affine uses UV for fast, reliable Python package management:
curl -LsSf https://astral.sh/uv/install.sh | shRestart your terminal or run source ~/.bashrc to update your PATH.
Step 2: Clone and Install Affine
git clone https://github.com/AffineFoundation/affine.git
cd affine
uv venv && source .venv/bin/activate
uv pip install -e .Verify your installation:
af --helpYou should see the Affine CLI help message.
Step 3: Configure Your Environment
Create a .env file based on the example:
cp .env.example .envEdit the file to add your API keys and configuration:
BITTENSOR_WALLET_NAME=your_wallet_name
BITTENSOR_WALLET_HOTKEY=your_hotkey
CHUTES_API_KEY=your_chutes_api_keyStep 4: Pull Current Models
To understand the current state of the network, pull the top-performing models:
af pull --top 5This downloads the top 5 models from the Pareto frontier for local evaluation and study.
Step 5: Evaluate Locally
Before making improvements, understand how models perform:
af evaluate --model ./models/top_1 --env DED-V2 ABD-V2This runs the model through the evaluation environments and reports scores.
Step 6: Train Improvements
This is where the magic happens. Use reinforcement learning to improve the model:
af train \
--base-model ./models/top_1 \
--env DED-V2 ABD-V2 \
--steps 10000 \
--output ./models/improvedTraining Tips
- Start small — Begin with fewer steps to validate your approach
- Monitor both environments — Ensure you're not regressing on one while improving another
- Use checkpoints — Save intermediate models to avoid losing progress
- Experiment with hyperparameters — Learning rate and batch size significantly impact results
Step 7: Validate Your Improvements
Before deploying, confirm your model achieves Pareto dominance:
af compare --model ./models/improved --baseline ./models/top_1The output will show whether your model dominates, is dominated by, or is incomparable with the baseline.
Step 8: Deploy to Chutes
Once you have a model that achieves Pareto dominance:
af deploy --model ./models/improved --name "my_improved_model_v1"This uploads your model to Chutes and registers it with the network.
Step 9: Commit On-Chain
Finally, commit your model to the Bittensor blockchain:
af commit --model-id <model_id_from_deploy>Monitoring Your Performance
Track your miner's performance:
af status --uid <your_uid>Or visit the live dashboard to see real-time metrics.
Common Issues
"CUDA out of memory"
Reduce batch size or use gradient checkpointing.
"Model not achieving dominance"
Ensure you're training on all environments, not just one.
"Deployment failed"
Check your Chutes API key and network connectivity.
Next Steps
- Join our Discord for community support
- Read the Pareto Frontier guide to understand the evaluation mechanism
- Check the FAQ for more troubleshooting tips
Happy mining! 🚀