Internals
Yuma Consensus
The consensus mechanism, its game-theoretic framework, Monte Carlo simulations, and consensus guarantees.
Bittensor uses a subjective utility consensus mechanism called Yuma Consensus which rewards subnet validators with scoring incentive for producing evaluations of miner-value which are in agreement with the subjective evaluations produced by other subnet validators weighted by stake. Subnet servers receive incentive for their share of the utility according to the subnet validator consensus. Yuma Consensus pertains to subnet validation, instead of blockchain validation (substrate), so this writing will always refer to subnet validators and servers.
Problem definition
How do we automatically detect and penalize reward manipulation in high-volume subjective utility networks?
Most utility networks serve objectively measurable utility, such as data storage (Filecoin, Siacoin, Storj, Arweave), computation (Golem, TrueBit, Flux, Render, iExec RLC, Near), wireless networking (Helium), video streaming (Theta, Livepeer), and music streaming (Audius). Each of these networks employs specific, quantifiable metrics for their services, ranging from gigabytes of storage and CPU/GPU cycles to network coverage, bandwidth utilization and streaming quality.
Objectively measurable utility makes it easy to detect and penalize reward manipulation, without the need for sophisticated consensus. Cryptographic proofs verify storage claims (Filecoin, Siacoin), outlier detection identifies and isolates inaccurate assessments (Ocean), cross-validation by multiple independent oracles reduce impact of single dishonest oracle (Chainlink), redundant computation prevents false result validation (Golem, TrueBit), random checks and challenges ensure honesty in computation results evaluation (iExec RLC), and continuous verification of actual network coverage (Helium). Objective utility networks typically need only basic majority consensus to correct malicious validation.
Subjective utility networks (such as Steemit, Hive, LBRY, Minds, Voice, etc.) typically revolve around community-generated and curated content. Lower-volume content production allows for manual voting and tipping by users, or measurements of user and viewer engagement to calculate rewards. These subjective utility networks predominantly rely on manual mechanisms for reward distribution and detection of malicious activity. Community-driven reporting and moderation (Steemit, Hive, Minds), manual content evaluation (LBRY, Voice), and real identity verification (Voice) deter and penalize reward manipulation.
Community oversight (as in Steemit) must identify wrongful downvoting, but only indirect remediation via counter-voting can penalize bad actors. The absence of voting reputation means users can only downvote the content of bad actors as retribution and thereby only damage content reputation, because no automated penalty mechanism exists. Similarly, users can upvote their own content and potentially receive nominal reward according to their stake, so reward manipulation may go unchecked.
High-volume, on-demand generative content (as in Bittensor) demands automated evaluation and divide-and-conquer validation, but introduces subjectivity both in the automated value measures and mutually exclusive task subsets across subnet validators. A coalition of validators can collude to skew scoring of subnet servers in their favour, which is harder to detect because of the inherent subjectivity. Existing consensus mechanisms will fail to deter reward manipulation for such high-volume subjective utility networks, so the need for a more sophisticated consensus arises.
Consensus Mechanism
Yuma Consensus guarantees long-term network honesty despite persistent adversarial presence in high-volume subjective utility networks. It directly penalizes selfish scoring by down-correction to the majority consensus and slashing of cabal voting stake, and also penalizes low-scoring of honest servers via forfeited validator rewards when cabals don’t score at consensus.
Yuma Consensus is adversarially-resilient when majority stake is honest, via stake-based median scoring that punishes selfish weighting by minority stake (cabal). We clip excess weight above the maximum weight supported by at least -majority stake, which ensures selfish weighting is corrected and reduces voting stake of cabal validators via bonds penalty .
Max weight supported by -majority stake: We can plot a consensus graph for each active miner by ordering weights (y-axis) set on the target miner and recording cumulative stake (x-axis) of the source validators. The weight read at ratio of total active stake is the stake-based median, which means that at least stake supports that weight decision. Typically , which means that 50% of stake needs to agree on the relative utility of a miner, and we clip excess weight above this median to encourage subnet validators to vote fairly and uphold consensus.
Cabal sets low weight on honest majority: The median calculation ignores selfish subsets that vote dishonestly (cabals), if they have minority stake (less than -majority), when they set low weights on the honest majority. This means that a minority cabal cannot negatively influence the consensus weight on honest servers.
Cabal sets high self-weight: Cabal servers with poor utility will receive low weights from majority stake, and high self-weight from minority cabals will then get reduced to the low consensus. This means that minority cabals lose voting power as penalty for unfair voting while still receiving low consensus weight despite high self-weight. This consensus mechanism thus protects against selfish weighting if the majority stake is honest.
Game-theoretic framework
Preliminaries
We consider a two-team game between (protagonist) honest stake () and (adversarial) cabal stake (), with honest and cabal players, that have honest stake and cabal stake. They compete for total fixed reward , with honest emission and cabal emission , respectively. Then the stake updates to and , where decides the emission schedule. We normalize stake after the emission update, so that . The honest objective at least retains scoring power over all action transitions in the game, otherwise when honest emission will erode to 0 over time, despite a starting condition of .
We assume honest stake sets objectively correct weights on itself, and on the cabal, where honest weight represents an ongoing expense of the honest player such as utility production, sustained throughout the game. However, cabal stake has an action policy that freely sets weight on itself, and on the honest player, at no cost to the cabal player. Independent smaller cabals will downweight each other thereby weakening overall adversarial power, so we consider the worst-case of a unified cabal. Specifically, honest players set self-weight and weight on cabal players, while cabal players set self-weight and weight on honest players.
The cabal has the objective to maximize the required honest self-weight expense via
We then assume the honest majority can counter with a consensus policy allowed to modify all weights modulo player labels, so it is purely based on the anonymous weight distribution itself, optimizing the Nash equilibrium
Consensus policy
Majority stake enforces an independent and anonymous consensus policy (through a blockchain solution) that modifies the weights to minimize the expense , which has been maximized by the cabal applying an objectively incorrect gratis self-weight . Consensus aims to produce so that , by correcting the error . Note that the input cost remains fully expensed, and that merely modifies the reward distribution that follows, but not knowing which players are honest or cabal (anonymous property).
We propose a consensus policy that uses stake-based median as consensus weight , so that -stake (typically majority, i.e. ) decides the maximum supported weight on each subnet server . The indicator function adds stake if subnet validator supports a specific weight-level on server .
The consensus policy applies weight correction to weight excess above consensus, which (i) restricts server incentive in case of selfish weighting, and (ii) penalizes selfish validators by slashing their voting stake (bonds) and validation rewards. The bonds penalty controls the degree to which weights for bonds are cut above consensus, which decides the penalty against subnet validator rewards.
Validator bonding
A subnet validator bonds with server , where the instant bond value is the normalized bonds penalty clipped weighted stake.
Validators can speculate on server utility by discovering and bonding to promising new servers, but to reward such exploration we use an exponential moving average (EMA) bond over time. Instant bond at current timestep becomes an EMA observation. We sum typical % of the instant bond with remaining % of previous EMA bond, to bond over time and reward early discovery while preventing abrupt changes and its exploitation potential.
Reward distribution
Emission ratio decides the ratio of emission for validation rewards, and the ratio for server incentive. In the implementation is not a settable hyperparameter: incentive and dividends are each normalized to sum to one and then jointly renormalized, which fixes the split at whenever both sides are nonzero.
Subnet server incentive is normalized server rank (sum of consensus-clipped weighted stake).
Validation reward is the subnet validator's EMA bond with server multiplied with server incentive.
Mathematical definitions
| Variable | Equation | Description |
|---|---|---|
| Weight | Validator weight on server . | |
| Stake | Validator relative stake. | |
| Server prerank | Sum of weighted stake. | |
| Server consensus weight | -stake supported maximum weight on server . | |
| Consensus-clipped weight | Validator consensus-clipped weight on server . | |
| Server rank | Sum of consensus-clipped weighted stake. | |
| Server incentive | Ratio of incentive for server . | |
| Server trust | Relative server weight remaining after consensus-clip. | |
| Validator trust | Relative validator weight remaining after consensus-clip. | |
| Bonds penalty | Degree to cut bonds above consensus weight. | |
| Weight for bonds | Apply bonds penalty to weights. | |
| Validator bond | Validator bond with server . | |
| Validator EMA bond | Validator EMA bond with server . | |
| Validator reward | Validator portion of incentive. | |
| Emission ratio | Reward/incentive ratio for emission | |
| Emission | Emission for node . |
Subtensor epoch
Subtensor blockchain nodes calculate consensus and rewards during each subnet epoch with associated code excerpts as follows. Production runs the sparse variant (epoch_mechanism, invoked per mechanism from coinbase); the dense excerpt below is the test-only analogue with identical math. The EMA-bond lines show the legacy branch — subnets with Yuma3On enabled compute bonds through the liquid-alpha path (compute_bonds) instead.
let mut weights: Vec<Vec<I32F32>> = Self::get_weights(netuid_index); // Weight
let consensus: Vec<I32F32> = weighted_median_col(&active_stake, &weights, kappa); // Server consensus weight
let mut clipped_weights: Vec<Vec<I32F32>> = weights.clone();
inplace_col_clip(&mut clipped_weights, &consensus); // Consensus-clipped weight
let validator_trust: Vec<I32F32> = row_sum(&clipped_weights); // Validator trust
let mut ranks: Vec<I32F32> = matmul(&clipped_weights, &active_stake); // Server rank
inplace_normalize(&mut ranks);
let incentive: Vec<I32F32> = ranks.clone(); // Server incentive
let weights_for_bonds: Vec<Vec<I32F32>> =
interpolate(&weights, &clipped_weights, bonds_penalty); // Weight for bonds
let mut bonds_delta: Vec<Vec<I32F32>> = row_hadamard(&weights_for_bonds, &active_stake); // Validator bond
inplace_col_normalize(&mut bonds_delta);
let mut ema_bonds = Self::compute_ema_bonds_normal(&bonds_delta, &bonds, netuid); // Validator EMA bond
inplace_col_normalize(&mut ema_bonds);
let mut dividends: Vec<I32F32> = matmul_transpose(&ema_bonds, &incentive); // Validator reward
inplace_normalize(&mut dividends);Monte Carlo simulations
We consider a two-team game between (protagonist) honest stake () and (adversarial) cabal stake (), with honest and cabal players, that have honest stake and cabal stake.
Network sizing
A network size of and validator count of is considered for consensus guarantee experiments, and the honest/cabal ratio reflects the honest stake ratio , but modifying extremes to ensure that each subset has at least one validator and at least one server.
Stake sampling
For the Monte Carlo simulations we use Gaussian distributions for stake and weight assignments, and ensure that the honest/cabal ratios are met. Note that stake is only assigned to validator nodes and and not servers.
Firstly, we sample initial validator () stake values with a typical standard deviation, followed by clamping to avoid negative stake:
Then we normalize each honest/cabal subset and multiply by its stake proportion, which thus gives an overall normalized stake and the correct stake ratio for each subset:
Weight sampling
Similarly, we randomize the weights that validators set on servers . Specifically, honest players set self-weight and weight on cabal players, while cabal players set self-weight and weight on honest players.
We firstly sample initial weights with various standard deviations ranging in , but then clamping to avoid negative weights:
Weight setting between the two subsets forms quadrants , , , and , so we ensure those weight ratios are met by normalizing each weight subset and multiplying by the corresponding quadrant ratio:
Emission calculation
Given the simulation parameters of the network size, validator count, a defined major/honest stake , a defined major/honest utility , and a defined minor/cabal self-weight , we have now instantiated the network with randomly sampled stake and weights and can proceed with an emission calculation.
We calculate the consensus for each server , and calculate consensus-clipped weights . This then gives us the adjusted weights that offers a measure of protection against reward manipulation.
To calculate emissions for this epoch, we firstly calculate server rank then incentive , as well as validator bonds and rewards .
Then we add up server incentive and validator bonds over honest nodes to obtain honest emission with a typical validator reward ratio of . The objective is to prove major stake retention for a single epoch, which by extension proves retention over many epochs due to additive nature of EMA bonds, so we do not bother with validator EMA bonds in these experiments.
The honest objective at least retains scoring power over all action transitions in the game, otherwise when honest emission will erode to 0 over time, despite a starting condition of .
Consensus guarantees
Yuma Consensus guarantees honest majority stake retention even under worst-case adversarial attacks, given sufficiently large honest utility . The specific honest stake and utility pairs that delineate the guarantees are complicated by natural variances inside large realistic networks. Therefore, we use extensive random sampling simulations (Monte Carlo studies) of large realistic networks and subject them to varying degrees of adversarial attacks, and calculate comprehensive consensus guarantees under representative conditions. Note the primary assumption is that the majority stake is honest, so we use majority/honest interchangeably, same with minority/cabal.
Retention graphs
Consensus guarantees are dependent on stake, utility, and subnet validator behaviour, so we use 2D contour plots to comprehensively display guarantees across each possible set of conditions. The x-axis is major self-weight and the y-axis is minor self-weight, and each contour line is a specific major stake. Major/honest self-weight is the true honest utility, while minor/cabal self-weight is an arbitrary value a self-serving coalition may self-report.
To understand how we construct these plots, let us first consider contour plot for a single major/honest stake setting . Here each contour value is the honest emission , and we highlight at (1) the specific contour that matches the honest stake. This means that any weight setting on contour will retain honest stake, while any setting to the right of it will grow honest stake.
Similarly, the specific emission contour plot for , highlights the contour where the emission is , which means with inflation the honest share ratio of can be retained if honest utility is at least .
A compound plot then combines all the highlighted contours from individual contour plots (e.g. and ), to show the overall retention profile. Generally, the higher the honest stake, the higher the honest utility requirement to retain stake proportion under adversarial weight setting.
Retention graphs like these comprehensively capture consensus guarantees across all primary conditions, and we utilize these to analyze the effect of consensus hyperparameters. Subtensor integration tests run Monte Carlo simulations of large realistic networks under adversarial conditions, and constructs retention profiles to confirm consensus guarantees of the actual blockchain implementation.
Retention profiles are reproducible by running test map_consensus_guarantees() and plotting with map_consensus.py.
RUST_BACKTRACE=1 SKIP_WASM_BUILD=1 RUSTFLAGS="-C opt-level=3" cargo test --manifest-path=pallets/subtensor/Cargo.toml -- tests::consensus::map_consensus_guarantees <bonds_penalty> --exact --ignored --nocapture > consensus.txt
python scripts/map_consensus.py consensus.txtSubjectivity variance
Yuma Consensus corrects reward manipulation in subjective utility networks, but the extent of subjectivity influences the exact consensus guarantees. In particular, we expect lower subjectivity to offer improved guarantees since there is stronger consensus. However, for higher variance in assigned weights it is easier to hide reward manipulation, we then expect poorer guarantees.
We assume normally distributed weights originating from a particular side, either honest or cabal, then we modify the weight deviation magnitude in terms of the mean weight . Weight deviations of , , and respectively require 60%, 67%, and 73% honest utility to preserve 60% honest stake. This confirms the expectation that higher subjectivity variance demands greater honest utility for honesty preservation.
Bitcoin has its well-known 51% attack, while Yuma Consensus has a 40% stake + 30% utility attack under high subjectivity (). This means that a bad actor with 40% stake that produces 30% utility or more can gain majority stake over time. In practice, we typically observe standard deviations of to , so Yuma Consensus guarantees honest 60% stake retention for ~70% honest utility or more.
Majority ratio (κ)
Hyperparameter Kappa sets the ratio of stake that decides consensus, with a typical recommended value of , which means that at least 50% of stake needs to be in consensus on the maximum weight assignable to a specific server.
Reducing weakens consensus and allows smaller cabals to manipulate rewards, in particular demands higher honest utility when (such as and ).
Increasing demands greater honest stake, e.g. when there is no protection for even with .
Hence is typically the most sensible setting.
Bonds penalty (β)
Yuma Consensus separately adjusts server incentive and validation reward to counter manipulation, where the extent of validation reward correction depends on the bonds penalty .
Server incentive always corrects fully, but validation reward correction is adjustable to control the penalty of out-of-consensus validation.
Lower-stake validators may experience lower service priority, which can result in partial validation, or exploratory validators may skew weighting toward emergent high-utility.
Full bonds penalty may not be desired, due to the presence of non-adversarial cases like these. Note that the chain default (BondsPenalty) is nonetheless full penalty ; subnets can lower it via hyperparameter.
We expect that greater bonds penalty will penalize out-of-consensus validators more, which means less emission going to cabals. Comprehensive simulation with , , and respectively show 78%, 76%, and 73% honest utility requirement. This confirms the expectation, that greater bonds penalty means greater inflation going to the honest majority.
Emission ratio (ξ)
Subnet servers need incentive to deliver high utility, and subnet validators need rewards to secure the network. We expect that more emission going to validators will improve security guarantees, since self-serving validation can then be economically disincentivized.
We set validation reward ratio at , , and and respectively observe 82%, 78%, 73% honest utility requirement for 60% honest stake preservation. This means that network security improves as the validation reward ratio is increased, although a significant server incentive ratio still needs to be maintained to ensure overall high utility.
Reproduce Consensus Plots (Runpod)
This guide demonstrates how to reproduce consensus retention profile plots on a minimal Runpod CPU instance.
1. Deploy Runpod Instance
Navigate to https://www.runpod.io/console/deploy and select the following:
- Pod Type: CPU Pod, CPU5 (5.7 GHz • DDR5 RAM • NVMe) or equivalent.
- Instance Configuration: Compute-Optimized ($0.07/hr, 2 vCPUs, 4GB RAM).
Important: Edit the template and set "Container Disk (Temporary)" to 20GB. This ensures sufficient disk space for the process.
Retrieve the connection details, including the SSH command and port, under "Connect" -> "SSH over exposed TCP". You can optionally enable Jupyter access (8888:localhost:8888) if desired. Connect to your instance via SSH:
ssh -L 8888:localhost:8888 root@<your_vps_ip_address> -p <your_vps_port> -i ~/.ssh/id_ed25519 # Replace placeholders2. Set up the Environment
-
Start a
tmuxsession for persistence:tmux -
Update system packages and install prerequisites (Python, Rust, and dependencies):
sudo apt-get update && sudo apt install -y build-essential clang curl git make libssl-dev llvm libudev-dev protobuf-compiler python3 python3-pip \ && curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y \ && source ~/.cargo/env \ && rustup default stable \ && rustup update \ && rustup target add wasm32v1-none -
Clone the Subtensor repository and checkout the relevant branch:
git clone https://github.com/RaoFoundation/subtensor.git cd subtensor git checkout main
3. Simulate Networks and Generate Data
The Subtensor integration tests simulate large, realistic networks under adversarial conditions to generate retention profiles that validate the blockchain's consensus guarantees. Building takes about 10 minutes, and the actual test itself another 15 minutes approximately.
RUST_BACKTRACE=1 SKIP_WASM_BUILD=1 RUSTFLAGS="-C opt-level=3" cargo test --manifest-path=pallets/subtensor/Cargo.toml -- tests::consensus::map_consensus_guarantees <bonds_penalty> --exact --ignored --nocapture > consensus.txtThis command runs the map_consensus_guarantees test and saves the output to consensus.txt. Replace <bonds_penalty> with a float e.g. 1.0 (100% bonds penalty).
4. Generate Contour Plots
-
Create a Python virtual environment and install necessary libraries:
python3 -m venv .venv source .venv/bin/activate pip install numpy matplotlib jupyterlab -
Run the plotting script:
python3 scripts/map_consensus.py consensus.txtThis generates an SVG file named
consensus_plot.svgin the current directory.
5. Explore and Modify (Optional)
You can use Jupyter-lab to interactively explore and modify the generated plots:
-
Start Jupyter-lab (on VPS):
jupyter-lab --allow-root --port=8888 -
Connect to Jupyter: Open the provided URL (e.g.,
http://localhost:8888/tree?token=...) in your local workstation web browser. -
Modify the plotting script: Edit
scripts/map_consensus.pyto customize the plots, otherwise download the SVG file.
Disclaimer
This reproduction procedure is provided as a guide and may require adjustments depending on your specific VPS environment and configuration. While every effort has been made to ensure accuracy and completeness, variations in system setup, software versions, or network conditions could affect the results.
Please exercise caution when executing commands with root privileges and ensure you understand the potential implications before proceeding. The author assumes no responsibility for any issues arising from the use of this procedure. If you encounter problems or have suggestions for improvement, please open an issue on this repository.