Consensus-based Weights
This guide describes how to use the consensus-based weights feature (also called "liquid alpha").
With this feature, a subnet validator's dividends are better correlated to the performance of the subnet miner on which the subnet validator is setting the weights. In this context, see also the documentation for the Commit Reveal feature, as both these features help the subnet validators find new subnet miners that perform well and bond to them quickly.
Technical paper, blog
- See Amplifying the Weight-copying Penalty in Bittensor, a working paper (PDF).
- Blog post: Consensus-based Weights.
- Subtensor document section: Validator bonding.
Collab notebooks
A subnet owner can run the weight_copy/liquid_alpha_diagnostic.ipynb
in the Python notebook below to experiment and choose the right values for the hyperparameters alpha_low
, alpha_high
, and commit_reveal_interval
.
- For commit reveal diagnostic: https://colab.research.google.com/github/opentensor/developer-docs/blob/main/static/weight_copy/commit_reveal_diagnostic.ipynb?authuser=5
- For liquid alpha diagnostic: https://colab.research.google.com/github/opentensor/developer-docs/blob/main/static/weight_copy/liquid_alpha_diagnostic.ipynb?authuser=5
- GitHub directory with Python notebooks.
Description
Currently, while calculating the dividends to a subnet validator, a quantity called , defined as an instantaneous bond value of a subnet validator with the subnet miner , is used.
A subnet validator maintains an instantaneous bond value on each subnet miner. However, while calculating a subnet validator's dividends, instead of directly using the instantaneous bond value , we use , an exponential moving average (EMA) of the bond value, weighted over the current epoch and the previous epoch. See the below equation for how this EMA is computed, where is the current epoch time and is the previous epoch time:
This EMA, , helps in the early discovery of promising subnet miners and prevents abrupt changes to the bond value. Typically, any abrupt change in the bond value indicates exploitation.
Finally, the dividend to a subnet validator is calculated as:
where is the EMA bond value of the subnet validator with the subnet miner , and is the subnet miner's incentive. See the subtensor document section, Validator bonding for a rigorous mathematical treatment of this topic.
What changed with this feature
Without the consensus-based weights feature, the in the above equation is set to 0.9
. With the consensus-based weights feature, this value is made into a variable. An optimum value for the variable is determined based on the current consensus (YC-2) in a given subnet. Hence, this feature is called consensus-based weights.
Using the new subnet hyperparameters that are described below, a subnet owner should experiment and discover the optimum for their subnet.
Installing the consensus-based weights feature
The consensus-based weights feature is available in Bittensor 7.3.0 and later versions. To use this feature, make sure you update to the 7.3.0
version.
Using test consensus-based weights feature
Summary steps
Here are summary steps to use the consensus-based weights feature. A subnet owner typically executes these steps:
- To activate this feature, a subnet owner should set the
liquid_alpha_enabled
(bool) hyperparameter toTrue
. - Next, the subnet owner should set the upper and lower bounds for by using a single subnet hyperparameter,
alpha_values
(List[int]).
You must set alpha_low
and alpha_high
together using alpha_values
. See below.
Default values, allowed ranges and value format
Default values
- The default value for
alpha_low
is0.7
. - The default value for
alpha_high
is0.9
. - The default value for
liquid_alpha_enabled
isFalse
.
Allowed ranges
- The range for both
alpha_low
andalpha_high
hyperparameters is(0,1)
. - However, until further notice, the
alpha_high
value must be greater than or equal to0.8
. - The value of
alpha_low
must not be greater than or equal toalpha_high
.
Value format
When you set the subnet hyperparameters alpha_low
and alpha_high
, you must pass their integer equivalents in u16
. This applies whether you set these hyperparameters using the btcli
command or in your Python code. These integer values are then converted by the subtensor into their corresponding decimal values in the u16
format.
Use the below conversion formula to determine the integer values for your desired decimal values for both alpha_low
and alpha_high
hyperparameters.
Hence, for example:
- If you want
alpha_low
to be0.1
, then you would pass6554
, which is the rounded up value of0.1 * 65535
. - If you want
alpha_high
to be0.8
, then you would pass52428
, which is the value of0.8 * 65535
.