masa-finance / masa-bittensor

Bittensor Subnet Config
https://masa.ai
MIT License
9 stars 11 forks source link

spike: Research Bittensor Hyperparameters #61

Closed Luka-Loncar closed 3 months ago

Luka-Loncar commented 3 months ago

Problem:

We do not understand which hyperparameters need setting for a subnet in order to go to production in July

Objective:

Investigate and understand the purpose, usage, and impact of all of Bittensor hyperparameters

Bittensor documentation: https://docs.bittensor.com/subnets/subnet-hyperparameters

Acceptance Criteria:

This SPIKE ticket will help gain a deeper understanding of these crucial Bittensor hyperparameters, enabling informed decisions when configuring and optimizing the Bittensor subnet.

hide-on-bush-x commented 3 months ago

Analysis of Hyperparameters

1. min_allowed_weights

2. max_weight_limit

btcli sudo set --param max_weight_limit --value 455 --netuid <NETUID>

3. immunity_period

btcli sudo set --param immunity_period --value 7200 --netuid <NETUID>

4. activity_cutoff

btcli sudo set --param activity_cutoff --value 5000 --netuid <NETUID>

5. tempo (not editable)

btcli sudo set --param tempo --value 99 --netuid <NETUID>

6. adjustment_alpha (not editable)

btcli sudo set --param adjustment_alpha --value 0.97 --netuid <NETUID>

7. adjustment_interval (not editable)

btcli sudo set --param adjustment_interval --value 112 --netuid <NETUID>

8. weights_version

btcli sudo set --param weights_version --value 2013 --netuid <NETUID>

9. weights_rate_limit

btcli sudo set --param weights_rate_limit --value 100 --netuid <NETUID>

Summary

Adjusting these hyperparameters involves balancing performance, security, and fairness. Higher min_allowed_weights and max_weight_limit promote balanced validator activity, while immunity_period and activity_cutoff ensure stability and active participation. Optimal settings vary by subnet needs, and careful monitoring post-adjustment is crucial for maintaining desired network dynamics.

teslashibe commented 3 months ago

@hide-on-bush-x it looks like hyperparameters for subnets are published here under TAO Stats for each subnet:

  1. https://x.taostats.io/subnet/13#hyperparams
  2. https://x.taostats.io/subnet/2#hyperparams
grantdfoster commented 3 months ago

Analysis of Hyperparameters Continued...

Adding the rest of the editable params, as outlined in this file

10. serving_rate_limit

11. min_difficulty

12. max_difficulty

13. network_registration_allowed

14. network_pow_registration_allowed

15. min_burn

16. max_burn

H34D commented 3 months ago

Summary

Adjusting these hyperparameters involves balancing performance, security, and fairness. Higher min_allowed_weights and max_weight_limit promote balanced validator activity, while immunity_period and activity_cutoff ensure stability and active participation. Optimal settings vary by subnet needs, and careful monitoring post-adjustment is crucial for maintaining desired network dynamics.

i am assuming they must be set by the subnet owner account / role. right?

mudler commented 3 months ago

seconding @H34D thoughts - few Q pops up in my head here:

hide-on-bush-x commented 3 months ago

@H34D Yes, this settings are set by the owner if the subnet @mudler we should start setting this params in one of our devnet subnets as a first experiment This hyperparameters can be seen by the user using the CLI

something like

btcli subnet hyperparameters --netuid 1 --subtensor.chain_endpoint  ws://54.205.45.3:9945
   Subnet Hyperparameters - NETUID: 1 - unknown
 HYPERPARAMETER              VALUE
   rho                       10
   kappa                     32767
   immunity_period           5000
   min_allowed_weights       1
   max_weight_limit          65535
   tempo                     360
   min_difficulty            18446744073709551615
   max_difficulty            18446744073709551615
   weights_version           0
   weights_rate_limit        100
   adjustment_interval       360
   activity_cutoff           5000
   registration_allowed      True
   target_regs_per_interval  1
   min_burn                  1
   max_burn                  100000000000
   bonds_moving_avg          900000
   max_regs_per_block        1
   serving_rate_limit        50
   max_validators            64
   adjustment_alpha          17893341751498265066
   difficulty                18446744073709551615

I will test weights_rate_limit by setting weights for a set of miners and then removing the rate limit after I get the error about "setting weights too fast" ( Will post my findings here )

mudler commented 3 months ago

@H34D Yes, this settings are set by the owner if the subnet @mudler we should start setting this params in one of our devnet subnets as a first experiment This hyperparameters can be seen by the user using the CLI

something like

btcli subnet hyperparameters --netuid 1 --subtensor.chain_endpoint  ws://54.205.45.3:9945
   Subnet Hyperparameters - NETUID: 1 - unknown
 HYPERPARAMETER              VALUE
   rho                       10
   kappa                     32767
   immunity_period           5000
   min_allowed_weights       1
   max_weight_limit          65535
   tempo                     360
   min_difficulty            18446744073709551615
   max_difficulty            18446744073709551615
   weights_version           0
   weights_rate_limit        100
   adjustment_interval       360
   activity_cutoff           5000
   registration_allowed      True
   target_regs_per_interval  1
   min_burn                  1
   max_burn                  100000000000
   bonds_moving_avg          900000
   max_regs_per_block        1
   serving_rate_limit        50
   max_validators            64
   adjustment_alpha          17893341751498265066
   difficulty                18446744073709551615

I will test weights_rate_limit by setting weights for a set of miners and then removing the rate limit after I get the error about "setting weights too fast" ( Will post my findings here )

Cool - can you create the relevant follow-up card for the implementation, pointing out where the the changes should happen in the codebase ? We are going to pick that up during planning then - Thanks!

hide-on-bush-x commented 3 months ago

Sure, will do 🫡