Skip to content

inference-labs-inc/subnet-2

Subnet 2 [τ, β]

Discord Chat

Proof of Inference

Autonomy unbridled. Governed by math, not blind faith.

DocumentationInference LabsStatsStudioDashboard

Subnet 2 represents a significant stride in enhancing the Bittensor network, aiming to create the world's largest peer-to-peer Verified Intelligence network, by building a Proof-of-Inference system for the Bittensor network. This initiative aligns with the Opentensor foundation's criteria for innovative subnet solutions. zk-ML allows AI models to be converted into a unique 'fingerprint,' a circuit that can be used to verify that a model's prediction was generated by a specific AI model, thereby providing what we term as Proof-of-Inference.

The miner and validator are native Rust binaries communicating over both HTTP and QUIC (via btlightning). Pre-built binaries are published as GitHub releases; the binaries include a built-in auto-update mechanism that polls for new releases every 5 minutes and performs atomic binary replacement so PM2 restarts with the new version.

Miners and Validators Functionality

Incentive Mechanism and Reward Structure

Subnet 2 incentivizes miners and validators to contribute to the generation and validation of high-quality, secure, and efficient verified AI predictions using a specialized reward mechanism aligned with the unique aspects of zero-knowledge machine learning (zk-ML) and decentralized AI. Zero-knowledge proofs are generally more CPU computationally intensive and open the opportunity for non-GPU miners to participate, however the end goal is to further incentivize the development of proving systems optimized for GPU-based operations. The incentives are based around miners creating succinct and efficient models which can be circuitized with a zero-knowledge proving system.

The reward mechanism scores the initial AI predictions based on the cryptographic integrity and time to generate zk-proofs along with the outputs, rather than solely on end results. This approach reduces the computational burden on validators as zk-proofs confirm the source model and integrity of AI predictions efficiently.

Miners

  • Receive input data from validators on the subnet
  • Generate predictions using custom, verifiable AI models that have been converted into zero-knowledge circuits
  • Return the generated content to the requesting validator for validation and distribution

Validators

  • Produce input data and distribute requests for verified inference throughout miners participating on the subnet
  • Confirm that miners are acting faithfully, by verifying the authenticity of the miner's returned zero-knowledge proof
  • Score results from miners based on performance metrics such as proof size and response time

Quickstart

Prerequisites

Tool Description
Rust Required to build from source. Install via curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
PM2 Process manager used to run and monitor the binaries in the background
btcli CLI for interacting with the Bittensor network (wallet creation, registration)

Alternatively, use Docker — no Rust toolchain needed. See the Docker instructions under Run the Miner and Run the Validator below.

Install from pre-built binary

Automatically detects your platform, downloads the latest release, verifies the SHA256 checksum, and installs to /usr/local/bin:

curl -fsSL https://raw.githubusercontent.com/inference-labs-inc/subnet-2/main/install.sh | bash

To install only the miner or validator:

curl -fsSL https://raw.githubusercontent.com/inference-labs-inc/subnet-2/main/install.sh | bash -s -- sn2-miner
curl -fsSL https://raw.githubusercontent.com/inference-labs-inc/subnet-2/main/install.sh | bash -s -- sn2-validator

For testnet builds (from the testnet branch):

curl -fsSL https://raw.githubusercontent.com/inference-labs-inc/subnet-2/testnet/install.sh | NETWORK=testnet bash
curl -fsSL https://raw.githubusercontent.com/inference-labs-inc/subnet-2/testnet/install.sh | NETWORK=testnet bash -s -- sn2-miner
curl -fsSL https://raw.githubusercontent.com/inference-labs-inc/subnet-2/testnet/install.sh | NETWORK=testnet bash -s -- sn2-validator

Or download manually from GitHub Releases.

Build from source

git clone https://github.com/inference-labs-inc/subnet-2.git
cd subnet-2
cargo build --release --bin sn2-validator --bin sn2-miner

Binaries will be at target/release/sn2-validator and target/release/sn2-miner.

Setup guide →

Register on the Subnet

btcli subnet register --subtensor.network finney --netuid 2 --wallet.name {your_coldkey} --wallet.hotkey {your_hotkey}

Run the Miner

Docker

With docker compose (recommended)

---
services:

  subnet-2-miner:
    image: ghcr.io/inference-labs-inc/subnet-2:latest
    restart: unless-stopped
    ports:
      - 8091:8091
    volumes:
      - {path_to_your_.bittensor_directory}:/home/subnet2/.bittensor
    environment:
      - PUID=1000
      - HOME=/home/subnet2
    labels:
      - com.centurylinklabs.watchtower.enable=true
    command: sn2-miner --wallet-name {your_miner_key_name} --wallet-hotkey {your_miner_hotkey_name} --netuid 2

  watchtower:
    image: containrrr/watchtower:latest
    restart: unless-stopped
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
    command: --interval 60 --cleanup --label-enable

With docker cli

docker run -d \
  --name subnet-2-miner \
  -p 8091:8091 \
  -v {path_to_your_.bittensor_directory}:/home/subnet2/.bittensor \
  -e PUID=1000 \
  -e HOME=/home/subnet2 \
  --restart unless-stopped \
  ghcr.io/inference-labs-inc/subnet-2:latest \
  sn2-miner \
  --wallet-name {your_miner_key_name} \
  --wallet-hotkey {your_miner_hotkey_name} \
  --netuid 2

With PM2

make pm2-miner WALLET_NAME={your_miner_key_name} WALLET_HOTKEY={your_miner_hotkey_name}

Or directly (use ./sn2-miner for pre-built binaries, target/release/sn2-miner for source builds):

pm2 start ./sn2-miner --name subnet-2-miner --kill-timeout 3000 -- \
  --wallet-name {your_miner_key_name} \
  --wallet-hotkey {your_miner_hotkey_name} \
  --netuid 2

Run the Validator

Docker

With docker compose (recommended)

---
services:

  subnet-2-validator:
    image: ghcr.io/inference-labs-inc/subnet-2:latest
    restart: unless-stopped
    ports:
      - 8443:8443
      - 9090:9090
    volumes:
      - {path_to_your_.bittensor_directory}:/home/subnet2/.bittensor
    environment:
      - PUID=1000
      - HOME=/home/subnet2
    labels:
      - com.centurylinklabs.watchtower.enable=true
    command: sn2-validator --wallet-name {validator_key_name} --wallet-hotkey {validator_hotkey_name} --netuid 2

  watchtower:
    image: containrrr/watchtower:latest
    restart: unless-stopped
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
    command: --interval 60 --cleanup --label-enable

With docker cli

docker run -d \
  --name subnet-2-validator \
  -p 8443:8443 \
  -p 9090:9090 \
  -v {path_to_your_.bittensor_directory}:/home/subnet2/.bittensor \
  -e PUID=1000 \
  -e HOME=/home/subnet2 \
  --restart unless-stopped \
  ghcr.io/inference-labs-inc/subnet-2:latest \
  sn2-validator \
  --wallet-name {validator_key_name} \
  --wallet-hotkey {validator_hotkey_name} \
  --netuid 2

With PM2

make pm2-validator WALLET_NAME={validator_key_name} WALLET_HOTKEY={validator_hotkey_name}

Or directly (use ./sn2-validator for pre-built binaries, target/release/sn2-validator for source builds):

pm2 start ./sn2-validator --name subnet-2-validator --kill-timeout 3000 -- \
  --wallet-name {validator_key_name} \
  --wallet-hotkey {validator_hotkey_name} \
  --netuid 2

Miner

Miners contribute to this subnet by providing compute to generate output from, and prove AI model inferences. Miners receive workloads from validators in the form of input data, perform verified inferences on those inputs and respond with output along with a zero-knowledge proof of inference.

Hardware requirements

Minimum

Component Requirement
CPU 8 core 3.2GHz
RAM 32GB
Network Up 400Mbps
Network Down 400Mbps
Storage 1TB
Storage Medium NVMe SSD

Recommended

Note

Exceeding these requirements in terms of storage, network and CPU speed will most likely result in higher rewards due to performance incentivization.

Component Recommendation
CPU 8 core 3.6GHz+
RAM 64GB+
Network Up 1Gbps
Network Down 1Gbps
Storage 2TB
Storage Medium NVMe SSD

Validator

Validators are responsible for verifying model outputs as provided by miners, and updating that miner's score based on the verification results.

Hardware requirements

Minimum

Component Requirement
CPU 8 core 3.2GHz
RAM 16GB
Network Up 400Mbps
Network Down 400Mbps
Storage 1TB

Recommended

Component Recommendation
CPU 8 core 3.4GHz
RAM 32GB
Network Up 1+Gbps
Network Down 1+Gbps
Storage 2+TB
Storage Medium SSD

Architecture

The codebase is organized as a Rust workspace with the following crates:

Crate Purpose
sn2-types Shared types, constants, and protocol definitions
sn2-chain Wallet, metagraph, registration, weights, and auto-update
sn2-verify Proof verification via the Expander backend
sn2-validator Validator binary
sn2-miner Miner binary

Both binaries communicate with miners/validators over HTTP (axum) and QUIC (btlightning). Chain interactions use subxt for direct Substrate RPC.

About

Verifiable inference on Bittensor

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors