Skip to content

feat: Add comprehensive federated learning, LLM inference, and IPFS storage infrastructure - #16

Merged
virajbhartiya merged 38 commits into
theblitlabs:mainfrom
virajbhartiya:main
Jul 20, 2025
Merged

feat: Add comprehensive federated learning, LLM inference, and IPFS storage infrastructure #16
virajbhartiya merged 38 commits into
theblitlabs:mainfrom
virajbhartiya:main

Conversation

@virajbhartiya

Copy link
Copy Markdown
Member

Overview

This PR implements a complete federated learning system, LLM inference capabilities, IPFS storage integration, and blockchain token management for the Parity Runner. The system now supports distributed machine learning, local LLM processing, and generic blockchain integration with configurable ERC20 tokens.

Major Features

Federated Learning System

  • Neural Network Training: Multi-layer perceptron support with configurable architectures
  • Linear Regression: Built-in regression training capabilities
  • Distributed Random Forest: Complete random forest implementation with federated learning
    • Bootstrap sampling with configurable subsample ratios
    • Random feature selection for tree splits
    • Out-of-bag (OOB) scoring for model validation
    • Feature importance calculation and tracking
    • Privacy-preserving distributed training
  • Data Partitioning Strategies: Random (IID), stratified, sequential, non-IID, and label skew
  • Numerical Stability: Comprehensive NaN protection and safe weight initialization
  • Model Aggregation: Automatic submission of weights and gradients to server

LLM Inference Capabilities

  • Ollama Integration: Seamless local LLM execution with automatic model management
  • Multi-Model Support: Qwen, LLaMA, Mistral, and other model support
  • Performance Optimization: Efficient GPU/CPU utilization for inference
  • Token Counting: Accurate tracking of prompt and response tokens for billing
  • Reliability Improvements: Signal handling and connection management

IPFS Storage Integration

  • Mandatory IPFS Storage: All datasets must be stored on IPFS and accessed via CID
  • Supported Formats: CSV and JSON data formats with automatic validation
  • Multiple Gateways: Uses multiple IPFS gateways for reliable data retrieval
  • Data Loading: Automatic download and validation of training datasets

Blockchain Integration

  • Generic Blockchain Support: Works with any EVM-compatible blockchain
  • Configurable ERC20 Tokens: Dynamic token symbols, names, and network names
  • Staking System: Device-based staking with reward distribution
  • Wallet Management: Keystore-based authentication and wallet operations

Tunnel Support

  • NAT/Firewall Traversal: Automatic tunneling using bore.pub for webhook exposure
  • Zero Configuration: Works out of the box with sensible defaults
  • Self-hostable: Support for private tunnel servers with authentication

Technical Implementation

Task Execution

  • Docker Support: Execute arbitrary containers with resource limits
  • Shell Commands: Run native shell scripts and commands
  • Resource Management: CPU, memory, and timeout controls
  • Hash Verification: Runner-side hash verification for execution integrity

…reum references to Filecoin in .env.sample and related CLI files - Adjust server settings and API endpoints accordingly
…d learning session management commands in CLI - Create a new FederatedLearningClient for session operations - Add storage management commands for IPFS/Filecoin integration - Update configuration structure for Filecoin settings
…figurations - Add new environment variables for IPFS storage settings and federated learning parameters
…rated Learning - Reorganize environment variables and clarify settings for Filecoin network and federated learning parameters
…PI docs

- Standardized all FL command structures with consistent patterns
- Added GetTrainedModel client method for model retrieval
- Enhanced configuration with proper FederatedLearning section
- Fixed URL construction in federated learning client
- Added comprehensive API reference documentation
- Implemented consistent help text and examples across all FL commands
- Added proper flag validation and error handling
…tandardization

feat: add federated learning
- Implement complete FL session lifecycle management (create, start, get, list)
- Add federated learning commands with extensive configuration options
- Support for dataset upload with IPFS/Filecoin integration
- Add model update submission with gradients file support
- Implement trained model retrieval and export functionality
- Add differential privacy configuration options
- Support for custom model configuration files
- Add comprehensive parameter validation and error handling
- Include detailed CLI examples and usage documentation
- Integrate with wallet authentication system for FL operations
…ated learning

- Implement 5 partitioning strategies: random, stratified, sequential, non-IID (Dirichlet), and label skew
- Add PartitionConfig struct with configurable parameters (alpha, min_samples, overlap_ratio)
- Update TrainingDataInfo to include metadata for partition configuration
- Enhance CLI commands with partitioning flags (--alpha, --min-samples, --overlap-ratio)
- Add LoadPartitionedData method to support distributed data loading
- Create comprehensive test script for all partitioning strategies
- Add detailed documentation for data partitioning functionality

This enables truly distributed federated learning where each participant
trains on different subsets of data, simulating realistic FL scenarios
with data heterogeneity and privacy-preserving data separation.
- Document the root cause of empty weights issue
- Explain the technical solution across all three repositories
- Provide code examples showing before/after states
- Include testing instructions and benefits achieved
- Add technical notes for future reference
…ity and required parameters

- Revise README to include detailed federated learning features and usage instructions
- Add model configuration examples and clarify required parameters for session creation
- Update CLI commands to enforce required flags for aggregation method, learning rate, batch size, and local epochs
- Improve error handling for missing model configuration
- Enhance documentation for differential privacy and data partitioning strategies
- Revise .env.sample to include new server and blockchain identity configurations
- Update CLI commands to replace PRTY with USDFC for token balance and stake operations
- Add new configuration options for logging, caching, and security settings
- Introduce GetReputationCommand in command structure
feat: add data partitioning for distributed federated learning
- Removed comments regarding the importance of the client and private key requirements
- Streamlined the configuration options for better clarity
- Add DisableTimestamp support to gologger
- Remove outdated documentation and test files
- Clean up repository structure
- Enhance logging configuration options
Gologger Improvements and Repository Cleanup
- Point gologger to commit 768e1ca (latest main)
- Ensure consistency across all repositories
- Update gologger submodule to commit 2e729e3
- Add environment variable support for disabling timestamps
- Enable runtime control of timestamp display
- Update gologger submodule to commit 3a60352
- Fix LOG_DISABLE_TIMESTAMP being ignored when using InitWithMode
- Ensure environment variables are respected across all logging modes
- Update gologger submodule to commit 032e8ba
- Fix stack overflow caused by recursive DefaultConfig/ConfigForMode calls
- Ensure LOG_DISABLE_TIMESTAMP works properly without crashes
- Modify target URL in proxy handler to include '/api/' prefix
- Update upload URL in task handler to use '/api/v1/tasks' path
…o Blockchain

- Rename FilecoinNetwork to BlockchainNetwork in config and related files
- Update environment variables in .env.sample and README.md
- Refactor wallet adapter initialization to use BlockchainNetwork settings
- Modify storage service references to reflect the change from Filecoin to Blockchain
- Clean up related comments and documentation for clarity
…files

- Update response body and file closure handling to log errors on close
- Remove unnecessary linter configurations in .golangci.yml
- Simplify lint command in Makefile
- Ensure proper error handling for port listener closure in network.go
- Enhance error handling for JSON body reading in http.go
- Upgrade golangci-lint-action from v3 to v4
- Specify golangci-lint version as v2.2.2 for consistency
- Remove unnecessary output format argument from golangci-lint action configuration
@virajbhartiya virajbhartiya self-assigned this Jul 20, 2025
- Disable all linters by default and selectively enable necessary ones in .golangci.yml
- Update local-prefixes for goimports to reflect new repository structure
- Downgrade golangci-lint-action from v4 to v3 and update version to v1.54.2 in workflow
- Adjust golangci-lint arguments for improved output formatting and timeout settings
- Add govet, ineffassign, and unused linters to .golangci.yml for improved code quality checks
…rs and adjust local-prefixes

- Remove govet, ineffassign, and unused linters from .golangci.yml
- Update local-prefixes for goimports to reflect new repository structure
- Add new linter for handling internal import errors in .golangci-ci.yml
- Upgrade Go toolchain version to 1.24.5 in go.mod
- Update Go version to 1.23 and golangci-lint version to latest in code quality workflow
@virajbhartiya
virajbhartiya merged commit c673798 into theblitlabs:main Jul 20, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant