docs.rs failed to build daa-prime-core-0.2.1
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
DAA Prime Core
Core shared structures and protocol definitions for the Prime distributed machine learning framework. This crate provides the foundational types, protocols, and message formats used across all Prime components.
Overview
DAA Prime Core is the foundational layer of the Prime distributed ML system, providing:
- Core Data Types: Essential types for nodes, models, training configurations, and metrics
- Protocol Definitions: Network message formats and protocol handling
- Serialization: JSON-based serialization for all network communications
- Error Handling: Unified error types and result handling
- Testing Support: Property-based testing utilities and test fixtures
Features
- ๐ง Type Safety: Strongly typed interfaces for all ML operations
- ๐ก Network Protocol: Comprehensive message types for distributed coordination
- โก Performance: Zero-copy serialization where possible
- ๐งช Testing: Built-in property-based testing support
- ๐ Documentation: Comprehensive API documentation
Installation
Add this to your Cargo.toml:
[]
= "0.2.1"
Quick Start
Basic Types
use ;
// Create a node identifier
let node_id = new;
// Configure training parameters
let config = TrainingConfig ;
Protocol Messages
use ;
// Create a protocol message
let sender = new;
let message = new;
// Serialize for network transmission
let serialized = to_string?;
// Send to specific recipient
let recipient = new;
let targeted_message = new
.with_recipient;
Gradient Updates
use ;
use HashMap;
// Create a gradient update
let update = GradientUpdate ;
Core Types
Node Management
NodeId: Unique identifier for network participantsModelMetadata: Model version and architecture informationTrainingConfig: Comprehensive training parameter configuration
ML Operations
OptimizerType: Support for SGD, Adam, and AdamW optimizersAggregationStrategy: Federated averaging, secure aggregation, and Byzantine-fault-tolerant methodsGradientUpdate: Structured gradient sharing between nodesTrainingMetrics: Training performance and timing metrics
Network Protocol
MessageType: All supported message types for distributed coordinationProtocolMessage: Signed, versioned message wrapperProtocolHandler: Trait for implementing custom message handlers
Message Types
The protocol supports several categories of messages:
Training Messages
GradientUpdate: Share model gradients with coordinatorsModelSync: Distribute updated model parametersTrainingRequest: Request participation in training rounds
Consensus Messages
ConsensusProposal: Propose values for consensusConsensusVote: Vote on consensus proposalsConsensusCommit: Commit agreed-upon values
DHT Messages
DhtPut: Store key-value pairs in distributed hash tableDhtGet: Retrieve values from DHTDhtResponse: Response with requested DHT values
Control Messages
Ping/Pong: Network connectivity testingJoinRequest/JoinResponse: Network participation coordination
Testing
The crate includes comprehensive testing utilities:
use *;
use *;
// Property-based testing for gradient updates
proptest!
Error Handling
All operations return Result<T, Error> for comprehensive error handling:
use ;
Integration with DAA Ecosystem
Prime Core integrates seamlessly with the broader DAA ecosystem:
- DAA AI: ML model management and inference
- DAA Rules: Governance and compliance checking
- DAA Economy: Token-based incentive mechanisms
Advanced Usage
Custom Message Handlers
use ;
use async_trait;
;
Model Metadata Management
use ModelMetadata;
let metadata = ModelMetadata ;
// Track model evolution
let updated_metadata = ModelMetadata ;
Performance Considerations
- Zero-Copy Serialization: Use
serde_json::from_slicefor network data - Message Batching: Combine multiple operations into single messages
- Compression: Consider compressing large gradient updates
- Connection Pooling: Reuse network connections where possible
Security
- Message Signing: All protocol messages support cryptographic signatures
- Version Validation: Protocol version checking prevents compatibility issues
- Input Validation: Comprehensive validation for all message types
Roadmap
- Protocol buffer support for binary serialization
- Built-in message compression
- Advanced aggregation strategies (Byzantine fault tolerance)
- Differential privacy support
- Homomorphic encryption integration
Contributing
Contributions are welcome! Please see our Contributing Guide for details.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Related Crates
daa-prime-dht: Distributed hash table implementationdaa-prime-trainer: Training node implementationdaa-prime-coordinator: Coordination and governancedaa-prime-cli: Command-line interface
Support
- ๐ Documentation
- ๐ Issue Tracker
- ๐ฌ Discussions