Yuma Consensus

Consensus

Stake-weighted consensus algorithm that determines validator trust, miner incentives, and emission distribution within subnets.

Click items to navigate to their reference pages.

The Big Picture

Yuma Consensus turns validator opinions into miner rewards. Every TAO earned by miners flows through this algorithm — it is the economic engine of Bittensor. Validators submit weight vectors scoring miners, and the algorithm aggregates them using stake-weighted median to resist manipulation by minority coalitions.

Why This Matters

Every TAO earned by a miner or validator flows through Yuma Consensus. Understanding it is essential for optimizing validator strategies, evaluating subnet health, and building applications on Bittensor.

Example Scenario

Suppose subnet 1 has 3 validators with stakes [500, 300, 200] TAO. Validator 0 scores Miner A at 0.8, Validator 1 scores 0.5, and Validator 2 scores 0.3. The stake-weighted median (κ=0.51) walks through sorted scores accumulating stake: 0.3 (20% stake), 0.5 (50% stake ≥ 49% minority). The consensus score is 0.5 — the majority-stake opinion wins.

Common Questions

Can a single large validator control consensus?
Only if they hold >51% of the stake. The weighted median ensures the majority stake coalition determines consensus.
What happens to weights above consensus?
They are clipped to the consensus value. This prevents validators from giving inflated weights to favored miners without losing trust.
How do bonds affect dividends?
Bonds are an EMA of validator-miner relationships. Validators earn dividends proportional to their bonds in high-incentive miners, rewarding consistent evaluation.

Use Cases

  • Evaluating subnet health and miner performance
  • Optimizing validator weight strategies
  • Understanding miner earning potential
  • Auditing consensus fairness across subnets
  • Building validator management tools

Yuma Consensus is the core algorithm that processes validator weight matrices to produce consensus scores for miners. Each epoch, validators submit weight vectors scoring miners. These weights are aggregated using stake-weighted median to produce a consensus weight matrix resistant to manipulation. From this, validator trust, miner incentive, and emission dividends are calculated.

The algorithm runs per-subnet at each epoch boundary (determined by Tempo). It reads the weight matrix and stake distribution, then writes updated consensus, incentive, dividend, and emission values to storage.

Triggers

  • Epoch boundary reached: (block_number + netuid + 1) % (tempo + 1) == 0

Inputs (8)

ItemTypeRole
Weights SubtensorModulestorageValidator weight vectors scoring miners
Alpha SubtensorModulestoragePer-hotkey Alpha balances per subnet (stake weight since dTAO)
TotalHotkeyAlpha SubtensorModulestorageAggregated Alpha stake per hotkey per subnet for consensus weighting
Bonds SubtensorModulestorageHistorical bond matrix for EMA calculation
Tempo SubtensorModulestorageBlocks per epoch for this subnet
Kappa SubtensorModulestorageConsensus majority threshold (typically 0.5)
BondsMovingAverage SubtensorModulestorageEMA smoothing factor for bond updates
ValidatorPermit SubtensorModulestorageWhich UIDs are permitted to validate

Outputs (7)

ItemTypeRole
Consensus SubtensorModulestorageConsensus weight per miner UID
Incentive SubtensorModulestorageIncentive scores determining miner rewards
Dividends SubtensorModulestorageValidator dividend shares from emissions
Trust SubtensorModulestorageValidator trust scores
Rank SubtensorModulestorageMiner ranking by incentive
Emission SubtensorModulestoragePer-UID emission amounts for this epoch
Bonds SubtensorModulestorageUpdated bond matrix after EMA

Source Files

pallets/subtensor/src/epoch/run_epoch.rs
epoch()epoch_dense()epoch_dense_mechanism()epoch_mechanism()
pallets/subtensor/src/epoch/math.rs
weighted_median()mat_ema()inplace_normalize()row_hadamard()matmul_transpose()

Formulas

Weighted Median

Core of Yuma Consensus. Computes stake-weighted median of validator scores for each miner, producing manipulation-resistant consensus weights.

For each miner j:
  1. Collect (stake_i, weight_ij) pairs from all validators i
  2. Sort by weight value
  3. Walk sorted list accumulating stake until >= majority (kappa)
  4. Median = weight at the majority crossing point

TypeScript: weightedMedian() in yuma-formulas.ts

Bond EMA

Exponential moving average blending current weights into historical bonds, smoothing validator-miner relationships over time. Input weights are blended between raw and clipped-to-consensus via bonds_penalty. Yuma3 applies EMA directly to weights; legacy path normalizes bonds_delta by stake first.

// weights_for_bonds = interpolate(weights, clipped_weights, bonds_penalty)
//   bonds_penalty=0 → raw weights, bonds_penalty=1 → fully clipped to consensus
// Yuma3: EMA applied directly to weights_for_bonds (or per-pair liquid alpha)
// Legacy: bonds_delta = col_normalize(hadamard(weights_for_bonds, active_stake))
B_new = alpha * W_for_bonds + (1 - alpha) * B_previous
alpha = 1 - BondsMovingAverage / 1_000_000

TypeScript: matEma() in yuma-formulas.ts

Trust Score

Fraction of a validator's weight vector that agrees with consensus. Trust[i] = sum_j(min(w_ij, consensus_j)). Weights are pre-normalized (row sums to 1.0) so no division is needed.

TypeScript: computeValidatorTrust() in yuma-formulas.ts

Consensus Simulator

Consensus Calculator

Experiment with validator weights and see how consensus is computed

Validators: 2
Miners: 3

Input: Validator Stakes & Weights

ValidatorStake (TAO)→ M0→ M1→ M2Actions
V0
V1

Step 1: Consensus (Weighted Median)

M0
0.500
M1
0.300
M2
0.200

Step 2: Clipped Weights

Validator→ M0→ M1→ M2Trust
V00.500 0.300 0.200 1.000
V10.400 0.300 (was 0.40)0.200 0.900

Step 3: Miner Incentive (Server Emission)

M0
47.92% 0.4792 τ
M1
31.25% 0.3125 τ
M2
20.83% 0.2083 τ

Step 4: Validator Dividends

V0
60.29% 0.6029 τ
V1
39.71% 0.3971 τ

Try this: Give one validator an extreme weight (e.g., 0.9 to M0) and see how it gets clipped to consensus. Notice that the validator's trust score decreases when their weights differ from consensus.

Collusion test: Create a minority validator coalition (combined stake <50%) all giving the same outlier weight. Watch how the weighted median ignores them entirely.

Related Workflows

set-weights
Read the deep dive: Yuma Consensus

Version History

v101 Initial Yuma Consensus implementation
v150 Added validator trust scoring and permit system
v200 Added sparse epoch mode for large subnets
v250 Bonds moving average made configurable per subnet
v290 Liquid alpha integration for dynamic stake weighting
v340 Child hotkey stake inheritance integrated into consensus
v360 CRV3 commit-reveal scheme for weight submission