Skip to content

Sushmit94/Fractal-Inference-Swarms

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fractal Inference Swarms (FIS)

Cortensor-Native AI Orchestration Infrastructure — A production-grade distributed inference system that decomposes complex tasks, routes them through Cortensor nodes, validates outputs, and distributes micropayments based on performance.


Table of Contents


🎯 Project Overview

Fractal Inference Swarms is a Kubernetes-like orchestration layer for decentralized AI inference. It sits on top of the Cortensor network and provides:

  • Intelligent Task Decomposition — Break complex prompts into atomic subtasks
  • Distributed Inference Routing — Route subtasks to multiple Cortensor nodes
  • Validation & Consensus — Validate outputs using Cortensor validators
  • Result Aggregation — Merge validated outputs into unified responses
  • PoUW-Based Scoring — Rank node performance using multi-factor metrics
  • Micropayment Distribution — Reward high-performing nodes with x402 tokens
  • Real-Time Observability — Monitor the entire swarm lifecycle via dashboard

This is not a prototype. This is enterprise-grade AI infrastructure designed for production workloads.


🏗️ Architecture

┌─────────────────────────────────────────────────────────────┐
│                     User Interface                          │
│              (Next.js Real-Time Dashboard)                  │
└────────────────────┬────────────────────────────────────────┘
                     │
                     ▼
┌─────────────────────────────────────────────────────────────┐
│                 Fractal Orchestrator                        │
│  ┌──────────────┐  ┌──────────────┐  ┌─────────────────┐   │
│  │ Task Splitter│  │ Merge Engine │  │ Scoring Engine  │   │
│  └──────────────┘  └──────────────┘  └─────────────────┘   │
│  ┌──────────────┐  ┌──────────────┐  ┌─────────────────┐   │
│  │  Validation  │  │Reward Engine │  │ WebSocket Server│   │
│  └──────────────┘  └──────────────┘  └─────────────────┘   │
└────────────────────┬────────────────────────────────────────┘
                     │
                     ▼
┌─────────────────────────────────────────────────────────────┐
│                  Cortensor Network                          │
│                                                             │
│  ┌─────────┐  ┌─────────┐  ┌─────────┐  ┌─────────┐       │
│  │ Node A  │  │ Node B  │  │ Node C  │  │ Node D  │  ...  │
│  └─────────┘  └─────────┘  └─────────┘  └─────────┘       │
│                                                             │
│  ┌──────────────────────────────────────────────────────┐  │
│  │          Cortensor Validators (Consensus)            │  │
│  └──────────────────────────────────────────────────────┘  │
└────────────────────┬────────────────────────────────────────┘
                     │
                     ▼
┌─────────────────────────────────────────────────────────────┐
│              Mock x402 Payment Ledger                       │
│          (Ready for Real Blockchain Integration)            │
└─────────────────────────────────────────────────────────────┘

✨ Key Features

🧠 Intelligent Orchestration

  • Automatic task decomposition into optimized subtasks
  • Dynamic subtask routing to available Cortensor nodes
  • State machine lifecycle tracking (see State Machine)

✅ Validation & Consensus

  • Cross-validation of outputs from multiple nodes
  • Cortensor validator consensus integration
  • Conflict resolution using confidence-weighted voting
  • Quality gates to reject low-confidence results

🔀 Result Merging

  • Synthesizes distributed outputs into a coherent final result
  • Contribution mapping — tracks which node provided what
  • Confidence scoring for merged output
  • Deduplication and format normalization

📊 PoUW-Based Scoring

Node performance is evaluated using a configurable multi-factor formula (see Scoring Formula):

  • Configurable weights via environment variables
  • Multi-dimensional node evaluation
  • Real-time leaderboard updates

💰 Economic Layer

  • Mock x402 micropayment distribution
  • reward = baseReward × normalizedScore
  • Complete transaction ledger with audit trail
  • Stake simulation (increases/slashing based on performance)

📡 Real-Time Dashboard

  • WebSocket-powered live updates
  • Agent spawn animations
  • Session lifecycle visualization
  • Validator consensus progress bars
  • Leaderboard and reward distribution charts

🚀 Getting Started

# Clone the repository
git clone https://github.com/your-org/fractal-inference-swarms.git
cd fractal-inference-swarms

# Install dependencies
npm install

# Configure environment variables
cp .env.example .env

# Start the orchestrator
npm run start

# Launch the dashboard
npm run dashboard

⚙️ Configuration

Environment Variable Description Default
CORTENSOR_ENDPOINT Cortensor network RPC endpoint http://localhost:8545
SCORING_WEIGHT_CONSENSUS Weight for consensus score (w₁) 0.30
SCORING_WEIGHT_CONFIDENCE Weight for confidence score (w₂) 0.25
SCORING_WEIGHT_SPEED Weight for speed score (w₃) 0.25
SCORING_WEIGHT_RELIABILITY Weight for reliability score (w₄) 0.20
BASE_REWARD Base x402 micropayment per task 100
WEBSOCKET_PORT Port for real-time dashboard feed 3001

🔄 State Machine

Each task passes through the following lifecycle stages:

CREATED → SPLIT → ROUTED → VALIDATING → MERGED → FINALIZED
State Description
CREATED Task received and queued
SPLIT Task decomposed into atomic subtasks
ROUTED Subtasks dispatched to Cortensor nodes
VALIDATING Outputs under consensus validation
MERGED Validated outputs aggregated
FINALIZED Result delivered, rewards distributed

📐 Scoring Formula

Node performance scores are computed as a weighted sum across four dimensions:

Final Score = w₁ × consensus + w₂ × confidence + w₃ × speed + w₄ × reliability

Where all weights (w₁ through w₄) sum to 1.0 and are configurable via environment variables. Reward distribution is then calculated as:

reward = baseReward × normalizedScore

📄 License

See LICENSE for details.

About

A production-grade distributed inference system that decomposes complex tasks, routes them through Cortensor nodes, validates outputs, and distributes micropayments based on performance.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages