Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 13 additions & 12 deletions docs/subnets/managing-mechanisms-btcli.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,8 @@ For a discussion of the background concepts, see [Understanding Multiple Incenti

See also: [Managing Mechanisms with SDK](managing-mechanisms-with-sdk).

:::tip Hot new feature
Multiple incentive mechanisms per subnet is a new feature that is still in development. It's initial release on mainnet is expected the week of September 22. In the meantime, it can be experimented with using a locally run chain.

See [Announcements](../learn/announcements) for updates.
:::

**Prerequisites**

- A local Subtensor chain running. See: [Run a Local Bittensor Blockchain Instance](../local-build/deploy)
- A local subnet created (and emissions started). See: [Create a Subnet (Locally)](../local-build/create-subnet)
- Wallets provisioned and funded for local development. See: [Provision Wallets](../local-build/provision-wallets)
Expand All @@ -27,19 +22,19 @@ Substitute your subnet's netuid, which you can find with `btcli subnet list`.
:::

:::warning Runtime limit
As of the current Subtensor runtime, a subnet can have a maximum of 2 mechanisms. Attempts to set a higher count will be rejected by the chain (runtime enforces `MaxMechanismCount = 2`).
As of the current Subtensor runtime, a subnet can have a maximum of 2 mechanisms. Attempts to set a higher count will be rejected by the chain (runtime enforces `DefaultMaxMechanismCount = 2`).

:::

## Check initial state

The following command will check the count of your subnet's incentive mechanisms and display the emissions split among them.


```bash
btcli subnet mech count --netuid 6 --network local
btcli subnet mech emissions --netuid 6 --network local
```

```
Subnet 6 currently has 1 mechanism.
(Tip: 1 mechanism means there are no mechanisms beyond the main subnet)
Expand All @@ -49,23 +44,30 @@ Subnet 6 only has the primary mechanism (mechanism 0). No emission split to disp

## Create a second mechanism

Create a second incentive mechanism by specifying the desired count as two for your subnet.
Create a second incentive mechanism by specifying the desired count as two for your subnet.

```bash
btcli subnet mech set --mech-count 2 --netuid 6 --network local
```

```
Subnet 6 currently has 1 mechanism. Set it to 2? [y/n]: y
✅ Mechanism count set to 2 for subnet 6
```

:::info Mechanism Count Constraint
Before attempting to modify the mechanism count on a subnet, ensure that the product of multiplying the new mechanism count by the maximum number of UIDs in the subnet remains less than 256. If it exceeds this threshold, you must first adjust the subnet’s `MaxAllowedUids` hyperparameter to accommodate the change.

To learn more about UID limit, see [UID trimming](./uid-trimming.md).
:::

Check the state to confirm the change

```bash
btcli subnet mech count --netuid 6 --network local
btcli subnet mech emissions --netuid 6 --network local
```

```
Subnet 6 currently has 2 mechanisms.
(Tip: 1 mechanism means there are no mechanisms beyond the main subnet)
Expand All @@ -86,15 +88,14 @@ Totals are expressed as a fraction of 65535 (U16_MAX).
No custom split found; displaying an even distribution.
```


## Set a custom 90/10 emission split

Let's allocate only 10% of our subnet's emissions to the second subnet.


```bash
btcli subnet mech emissions-split --netuid 6 --network local --split "90,10" --wallet-name alice
```

```
Subnet 6 • Emission split
Network: local
Expand Down Expand Up @@ -127,12 +128,12 @@ Proceed with these emission weights? [y/n] (y): y
✅ Emission split updated for subnet 6
```


We can confirm this by running the getter command again:

```bash
btcli subnet mech emissions --netuid 6 --network local
```

```

Subnet 6 • Emission split
Expand Down
16 changes: 8 additions & 8 deletions docs/subnets/managing-mechanisms-with-sdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: "Managing Multiple Incentive Mechanisms with SDK"
---

import { SdkVersion } from "../sdk/_sdk-version.mdx";
import { SdkVersion } from "../sdk/\_sdk-version.mdx";

# Managing Multiple Incentive Mechanisms with SDK

Expand All @@ -12,12 +12,6 @@ For background on the concepts, see [Understanding Multiple Incentive Mechanisms

See also [Managing Mechanisms with BTCLI](./managing-mechanisms-btcli).

:::tip Hot new feature
Multiple incentive mechanisms per subnet is a new feature that is still in development. It's initial release on mainnet is expected the week of September 22. In the meantime, it can be experimented with using a locally run chain.

See [Announcements](../learn/announcements) for updates.
:::

**Prerequisites**

- A local Subtensor chain running. See: [Run a Local Bittensor Blockchain Instance](../local-build/deploy)
Expand All @@ -30,7 +24,7 @@ Substitute your subnet's netuid, which you can find with `btcli subnet list`.
:::

:::warning Runtime limit
As of the current Subtensor runtime, a subnet can have a maximum of 2 mechanisms. Attempts to set a higher count will be rejected by the chain (runtime enforces `MaxMechanismCount = 2`).
As of the current Subtensor runtime, a subnet can have a maximum of 2 mechanisms. Attempts to set a higher count will be rejected by the chain (runtime enforces `DefaultMaxMechanismCount = 2`).
:::

## Initialize SDK and wallet
Expand Down Expand Up @@ -116,6 +110,12 @@ print("split:")
print(split_after)
```

:::info Mechanism Count Constraint
Before attempting to modify the mechanism count on a subnet, ensure that the product of multiplying the new mechanism count by the maximum number of UIDs in the subnet remains less than 256. If it exceeds this threshold, you must first adjust the subnet’s `MaxAllowedUids` hyperparameter to accommodate the change.

To learn more about UID limit, see [UID trimming](./uid-trimming.md).
:::

```text
Set mech count success: True
Subnet 7 mech count (after): 2
Expand Down
24 changes: 13 additions & 11 deletions docs/subnets/understanding-multiple-mech-subnets.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,23 @@ title: "Multiple Incentive Mechanisms Within Subnets"
import ThemedImage from '@theme/ThemedImage';
import useBaseUrl from '@docusaurus/useBaseUrl';

# Multiple Incentive Mechanisms Within Subnets
# Multiple Incentive Mechanisms Within Subnets

This page explores how subnets can implement multiple incentive mechanisms to distribute emissions across different evaluation criteria.

:::tip Hot new feature
Multiple incentive mechanisms per subnet is a new feature that is still in development. It's initial release on mainnet is expected the week of September 22. In the meantime, it can be experimented with using a locally run chain.

See [Announcements](../learn/announcements) for updates.
:::

For an introduction to incentive mechanisms in general, see [Understanding Incentive Mechanisms](../learn/anatomy-of-incentive-mechanism). For the basics of subnets, miners, validators, and the blockchain, see [Components of the Bittensor platform](../learn/neurons).

For coverage of the procedures involved, see:

- [Managing Mechanisms with SDK](./managing-mechanisms-with-sdk)
- [Managing Mechanisms with BTCLI](./managing-mechanisms-btcli)

:::info Mechanism Count Constraint
Before attempting to modify the mechanism count on a subnet, ensure that the product of multiplying the new mechanism count by the maximum number of UIDs in the subnet remains less than 256. If it exceeds this threshold, you must first adjust the subnet’s `MaxAllowedUids` hyperparameter to accommodate the change.

To learn more about UID limit, see [UID trimming](./uid-trimming.md).
:::

Historically, each subnet operates with a single **incentive mechanism**, a function that validators run to assign weights to miners based on the value of their work. Subnets can now support **multiple incentive mechanisms**, allowing a subnet creator to apportion the subnet's emissions across different evaluation criteria, each running Yuma Consensus _independently_ with separate bond pools to evaluate miners' performance on distinct tasks.

Each miner receives emissions separately from each incentive mechanism, so a miner's performance in one mechanism does not affect their rating in another, and their emissions for each epoch are summed across all mechanisms. Validators receive dividends as a weighted sum of their performance across all incentive mechanisms - they cannot choose which mechanisms to validate, and if they don't validate all mechanisms, they receive proportionally reduced emissions. Multiple incentive mechanisms don't change the total emissions to a subnet, but create a way for subnet creators to distribute those emissions to miners working on different tasks. This mechanism affords subnet creators a transparent, on-chain way to exercise fine-grained control over the work they are incentivizing, keeping miner effort focused on work that is most needed at a time.
Expand Down Expand Up @@ -99,6 +100,7 @@ As of the current Subtensor runtime, a subnet can have a maximum of 2 mechanisms

### Core Changes

- **Subnet trim**: Subnet owners must ensure that the mechanism count multiplied by the maximum number of UIDs in a subnet must be less than 256. To accommodate this threshold, they must adjust the subnet’s maximum UID hyperparameter before modifying the number of mechanisms. To learn more about subnet trimming, see [UID trimming](./uid-trimming.md).
- **Emission distribution**: You can control what percentage of total emissions goes to each incentive mechanism using the `sudo_set_mechanism_emission_split` extrinsic. When the number of mechanisms is set, the emission distribution is reset to an even split, but you can set it again with custom proportions.

:::info
Expand All @@ -123,9 +125,9 @@ For each subnet, the subnet creator keeps 18% of emissions, 41% is allocated to
Note that currently, only 2 mechanisms are allowed per subnet; it is planned that this cap will be raised in the future.
:::

- Mechanism 0 (60%): 100 $\tau$ X .41 X .6 = 24.6
- Mechanism 1 (30%): 100 $\tau$ X .41 X .3 = 12.3
- Mechanism 2 (10%): 100 $\tau$ X .41 X .1 = 4.1
- Mechanism 0 (60%): 100 $\tau$ X .41 X .6 = 24.6
- Mechanism 1 (30%): 100 $\tau$ X .41 X .3 = 12.3
- Mechanism 2 (10%): 100 $\tau$ X .41 X .1 = 4.1

:::info Setting Custom Proportions
To achieve the above distribution, the subnet owner would submit the `sudo_set_mechanism_emission_split` extrinsic with the vector `[39321, 19660, 6554]` (calculated as 60% × 65535, 30% × 65535, 10% × 65535).
Expand All @@ -138,7 +140,7 @@ Note that a miner who excels in mechanism 0 but performs poorly in others might
Multiple incentive mechanisms extend the existing metagraph with additional columns:

```
UID | Hotkey | Stake | Mechanism 0 Weights | Mechanism 1 Weights | Mechanism 0 Incentive | Mechanism 1 Incentive
UID | Hotkey | Stake | Mechanism 0 Weights | Mechanism 1 Weights | Mechanism 0 Incentive | Mechanism 1 Incentive
-----|--------|-------|---------------------|---------------------|----------------------|----------------------
123 | 5ABC...| 1000 | [0.3, 0.2, 0.1...] | [0.1, 0.4, 0.2...] | 0.05 τ | 0.02 τ
456 | 7DEF...| 800 | [0.2, 0.3, 0.2...] | [0.2, 0.3, 0.1...] | 0.03 τ | 0.04 τ
Expand Down