Emissions

Emissions for model validators

Outline


Generating Emissions

Emissions are generated on each epoch for model validators (peers) hosting models that submit consensus data on that epoch and are in consensus. After consensus has been formed, the rewards are generated in the following block. This is done automatically through the on_initialize hook that is called at the beginning of each block through validators (read more: https://paritytech.github.io/polkadot-sdk/master/frame_support/traits/trait.Hooks.html#method.on_initialize). In the case of generating rewards, it is called once per epoch in the generate_emissions() function.


Model Rewards

Each model's rewards are calculated based on the total stake of all the in-consensus model peers in that model versus the total stake of all in-consensus model peers. If a model or model peer is not included in that epoch's consensus, the stake balance is not counted towards calculating rewards distribution in that epoch.

Peer Rewards

Peer rewards are based on the scores and the stake balance of in-consensus model peers towards a specific model. This is based on the StakeRewardWeight being a percentage with the remaining (PERCENTAGE_FACTOR - StakeRewardWeight) going towards the scores rewards weight.

Example

Assuming the following parameters during an epoch:

  • Model rewards allotment: 100.0

  • StakeRewardWeight: 50%

  • Model Peers score sum: 100.0

  • Model stake balance sum: 100.0

  • Model Peer #1 score: 20.0

  • Model Peer #1 stake balance: 10.0

From there, we can consider the model rewards will be split into the following parameters:

stake_rewards = 100.0 * 0.50

score_rewards = 100.0 - stake_rewards

  • Model score rewards: 50.0

  • Model stake rewards: 50.0

The model peer in this example has 20% of the scores sum and 10% of the model stake balance. This would give the user a total of 15 tokens (15 = 50.0 * 20.0% + 50.0 * 10.0%) in rewards on that epoch. The rewards increase the peers' stake balance towards the model they are a peer within.


Requirements

The following requirements follow the consensus requirements. All of the consensus requirements must be true to generate emissions.

Model Rewards Requirements

Model Validator Rewards Requirements

  • Must be initialized for the minimum required epochs based on the MinRequiredPeerConsensusSubmitEpochs.

  • The model validator must have submitted consensus data.

  • The model validator must be in consensus.

  • A minimum of 0.01% must be staked towards the model based on the total staked amount towards that model of all in-consensus model validators.


Excess Distribution Algorithm (EDA)

No one model can have excess weight of rewards based on the MaxModelRewardsWeight. Weight is determined by the amount of stake balance of all in-consensus model peers towards a model on the specific epoch. If a model's weight is in excess, the excess weight will be distributed to all underweight models based on the weight of those models versus the sum of all underweight models.

This gives the ability for newly entered models to compete for rewards and incentivizes users to join the new model as model validators.

Examples

These examples are primarily to display the excess distribution algorithm. The total rewards are inaccurate as they do not account for the scoring portion of rewards calculations.

Assume the following weights on two models with a max model rewards weight of 50% with rewards on the epoch equaling 100 tokens:

  • [51.00%, 49.00%]

  • This will result in [50.00%, 50.00%] with 50 tokens rewarded to each model.

Index 0, or model 0, has 1 excess. This is because the max weight is 50%, resulting in a max model rewards weight of 50. Since 49 owns 100% of the sum of all underweight model weights, it gets 100% of the excess.

Assume the following weights on three models with a max model rewards weight of 50% with rewards on the epoch equaling 100 tokens:

  • [90.00%, 5.00%, 5.00%]

  • This will result in [50.00%, 25.00%, 25.00%] with tokens rewarded as 50, 25, and 25 respectively.

Index 0, or model 0, has 40 excess. This is because the max weight is 50%, resulting in a max model rewards weight of 50. Since both of the 5's each own 50% of the sum of all underweight model weights, they each get 50% of the excess.

In these examples, if new models enter the ecosystem it will incentivize users to spin up new nodes to become model validators. These new models will begin generating a higher portion of rewards than the amount of stake balance towards the new models, thus incentivizing users to enter the new models to contribute their computing power to take advantage of the emissions premium.

Annotation

  1. Initialization

    • Initialize an empty vector called model_weights_data to store tuples of model IDs and their emissions weights.

  2. Provide Initial Data - Calculate Initial Weights

    • Iterate through each model ID in the provided vector:

      • a. Retrieve the total stake for the current model ID.

      • b. Calculate the percentage of stake the current model holds relative to the total stake.

      • c. If the stake percentage is zero, increment the error count for the model's consensus epochs.

      • d. If the stake percentage is non-zero, add a tuple of the model ID and its stake percentage to model_weights_data.

  3. Determine Data Length

    • Determine the length of model_weights_data.

  4. Sort Data By Weight

    • Sort model_weights_data in descending order based on calculated initial weights.

  5. Calculating Initial Weight Sum

    • Calculate the total sum of the initial weights of all models.

  6. Determining Target Weight

    • Retrieve the maximum allowed weight for model rewards.

    • Ensure that the minimum weight for each model is achievable.

    • Calculate the target number of emissions weight based on the total sum of initial weights and the target weight.

  7. Handle & Redistribute Excess Weight

    • Iterate through each model in model_weights_data:

      • a. If the model's weight exceeds the target weight, set it to the target weight.

      • b. Otherwise, calculate the maximum amount of weight that can be allotted to the model, considering the remaining excess weight and the proportion of its weight relative to the total sum of weights.

      • c. Update the model's weight and adjust the remaining excess weight accordingly.

      • d. Update the total sum of weights by subtracting the model's weight.

Visual Representation


Information

The sum of the stake balance between all model validators is calculated through only live model validators and in-consensus peers. When model validators don't meet the model validator requirements, their stake balance is not calculated in the model rewards. This means only model peers that have submitted consensus and are in consensus are calculated when generating rewards. Further, model peers who have not submitted consensus or haven't reached the ability to submit consensus will not be included in rewards calculations.

Last updated