Scoring

Each subnet must have a scoring mechanism for each node to be scored based on the percentage ownership of the rewards generated for the subnet. This allows subnets the freedom to have any architecture with no bounds.

Each subnet has a set amount of rewards based on its memory requirements that each subnet node will compete for within the subnet defined by the subnet scoring mechanism.

Examples:

The DSN standard currently uses a scoring mechanism based on the percentage of transformer blocks they host.

Adding inference TPS as a weight of the scoring equation is planned for the DSN standard. As a subnet developer, one could build any scoring mechanism to the subnets use case(s).

The scoring can be based on anything:

  • Speed (using a ledger, IPFS, in-subnet ledger, Hypertensor smart contracts, etc.)

  • Accuracy (using a ledger, IPFS, in-subnet ledger, Hypertensor smart contracts, etc.)

  • Roles

  • Accounting (Hypertensor accounting mechanism)

  • Ledger validation

  • Attestation accuracy (Hypertensor validator mechanism)

  • etc.

Each scoring mechanism variable should be able to be verified. For example, in the subnet-llm-template, each subnet node can verify that another subnet node is hosting the blocks the system says they are by running its POI (Proof of Inference) mechanism.


Validator

At the start of each epoch, a blockchain validator will choose a subnet validator (for each subnet) at random. This subnet validator must submit each peer's scoring.

The subnet must always be listening for this to know which subnet node is responsible for submitting the data on that epoch.

The chosen subnet validator will be rewarded based on the accuracy of the data calculated from the attestation rate.

Submission

Each subnet must submit validation data to the blockchain per epoch of the scoring of each peer.

Attestation

For the submitted data to qualify for rewards in a given epoch, it must achieve an attestation rate of at least 66% from all subnet nodes.


Validator Submission:

keypair = Keypair.create_from_uri('//Alice') # replace with your mnemonic phrase

call = substrate.compose_call(
  call_module='Network',
  call_function='validate',
  call_params={
    'subnet_id': subnet_id,
    'data': data,
    'args': args,
  }
)

extrinsic = substrate.create_signed_extrinsic(call=call, keypair=keypair)

receipt = substrate.submit_extrinsic(extrinsic, wait_for_inclusion=True)

Arguments:

  • subnet_id: The subnet ID of the subnet

    • This should be initialized into the class responsible for consensus.

  • data: The data in the following format as a Vector:

    • pub struct SubnetNodeData {
          pub peer_id: PeerId,
          pub score: u128,
      }
    • In Python:

      • data = [{
            'peer_id': str,
            'score': int,
        }]

  • args: Arbitrary arguments the subnet can utilize during consensus.

Each validator submission is stored as aSubnetRewardsSubmissionunder the subnet ID and epoch:

pub type SubnetRewardsSubmission<T: Config> = StorageDoubleMap<
    _,
    Blake2_128Concat,
    u32, // subnet ID
    Identity,
    u32, // epoch
    RewardsData<T::AccountId>,
>;
pub struct RewardsData<AccountId> {
    pub validator: AccountId,
    pub attests: Attests<AccountId>,
    pub data: Vec<SubnetNodeData>,
    pub args: Option<BoundedVec<u8, DefaultValidatorArgsLimit>>,
}

Data Attestation:

keypair = Keypair.create_from_uri('//Alice') # replace with your mnemonic phrase

call = substrate.compose_call(
  call_module='Network',
  call_function='attest',
  call_params={
    'subnet_id': subnet_id,
  }
)

extrinsic = substrate.create_signed_extrinsic(call=call, keypair=keypair)

receipt = substrate.submit_extrinsic(extrinsic, wait_for_inclusion=True)

Arguments:

  • subnet_id: The subnet ID of the subnet

    • This should be initialized into the class responsible for consensus.

Each subnet node attestation updates theSubnetRewardsSubmissionto to include the attestor account_id and block attested. The data can be used in the following epoch(s) to be used for more accurate rewards, such as speed of attestation.

Last updated