Flow Nexus Neural Network Training SOP
metadata:
skill_name: when-training-neural-networks-use-flow-nexus-neural
version: 1.0.0
category: platform-integration
difficulty: advanced
estimated_duration: 45-90 minutes
trigger_patterns:
- "train neural network"
- "machine learning model"
- "distributed training"
- "flow nexus neural"
- "E2B sandbox training"
dependencies:
- flow-nexus MCP server
- E2B account (optional for cloud)
- Claude Flow hooks
agents:
- ml-developer (primary model architect)
- flow-nexus-neural (platform coordinator)
- cicd-engineer (deployment specialist)
success_criteria:
- Model training completes successfully
- Validation accuracy meets requirements (>85%)
- Performance benchmarks within thresholds
- Cloud deployment verified
- Documentation generated
Overview
This SOP provides a systematic workflow for training and deploying neural networks using Flow Nexus platform with distributed E2B sandboxes. It covers architecture selection, distributed training, validation, and production deployment.
Prerequisites
Required:
- Flow Nexus MCP server installed
- Basic understanding of neural network architectures
- Authentication credentials (if using cloud features)
Optional:
- E2B account for cloud sandboxes
- GPU resources for training
- Pre-trained model weights
Verification:
# Check Flow Nexus availability
npx flow-nexus@latest --version
# Verify MCP connection
claude mcp list | grep flow-nexus
Agent Responsibilities
ml-developer (Primary Model Architect)
Role: Design neural network architecture, select hyperparameters, optimize model performance
Expertise:
- Neural network architectures (Transformer, CNN, RNN, GAN, etc.)
- Training optimization and hyperparameter tuning
- Model evaluation and validation strategies
- Transfer learning and fine-tuning
Output: Model architecture design, training configuration, performance analysis
flow-nexus-neural (Platform Coordinator)
Role: Coordinate distributed training across cloud infrastructure, manage resources
Expertise:
- Flow Nexus platform APIs and capabilities
- Distributed training coordination
- E2B sandbox management
- Resource optimization
Output: Training orchestration, resource allocation, deployment configuration
cicd-engineer (Deployment Specialist)
Role: Deploy trained models to production, setup monitoring and scaling
Expertise:
- Model serving infrastructure
- Docker containerization
- CI/CD pipelines
- Monitoring and observability
Output: Deployment scripts, monitoring dashboards, production configuration
Phase 1: Setup Flow Nexus
Objective: Authenticate with Flow Nexus platform and initialize neural training environment
Evidence-Based Validation:
- Authentication token obtained and verified
- MCP tools responding correctly
- Training environment initialized
ml-developer Actions:
# Pre-task coordination hook
npx claude-flow@alpha hooks pre-task --description "Setup Flow Nexus for neural training"
# Restore session context
npx claude-flow@alpha hooks session-restore --session-id "neural-training-$(date +%s)"
flow-nexus-neural Actions:
# Check authentication status
mcp__flow-nexus__auth_status { "detailed": true }
# If not authenticated, register/login
# mcp__flow-nexus__user_register { "email": "user@example.com", "password": "secure_pass" }
# mcp__flow-nexus__user_login { "email": "user@example.com", "password": "secure_pass" }
# Initialize neural training cluster
mcp__flow-nexus__neural_cluster_init {
"name": "neural-training-cluster",
"architecture": "transformer",
"topology": "mesh",
"daaEnabled": true,
"wasmOptimization": true,
"consensus": "proof-of-learning"
}
# Store cluster ID in memory
npx claude-flow@alpha memory store --key "neural/cluster-id" --value "[cluster_id]"
cicd-engineer Actions:
# Prepare deployment environment
mkdir -p neural/{models,configs,scripts,tests}
# Initialize configuration
cat > neural/configs/training.json << 'EOF'
{
"cluster": {
"topology": "mesh",
"maxNodes": 8,
"autoScale": true
},
"training": {
"batchSize": 32,
"epochs": 100,
"learningRate": 0.001,
"optimizer": "adam"
},
"validation": {
"splitRatio": 0.2,
"minAccuracy": 0.85
}
}
EOF
# Post-edit hook
npx claude-flow@alpha hooks post-edit --file "neural/configs/training.json" --memory-key "neural/config"
Success Criteria:
- Flow Nexus authenticated successfully
- Neural cluster initialized
- Configuration files created
- Memory context established
Memory Persistence:
# Store phase completion
npx claude-flow@alpha memory store \
--key "neural/phase1-complete" \
--value "{\"status\": \"complete\", \"cluster_id\": \"[id]\", \"timestamp\": \"$(date -Iseconds)\"}"
Phase 2: Configure Neural Network
Objective: Design network architecture, select hyperparameters, prepare training configuration
Evidence-Based Validation:
- Architecture validated against task requirements
- Hyperparameters optimized for dataset
- Configuration tested with sample data
ml-developer Actions:
# Retrieve cluster information
CLUSTER_ID=$(npx claude-flow@alpha memory retrieve --key "neural/cluster-id" | jq -r '.value')
# List available templates for reference
mcp__flow-nexus__neural_list_templates {
"category": "classification",
"limit": 10
}
# Design custom architecture
cat > neural/configs/architecture.json << 'EOF'
{
"type": "transformer",
"layers": [
{
"type": "embedding",
"inputDim": 10000,
"outputDim": 512
},
{
"type": "transformer-encoder",
"numHeads": 8,
"dimModel": 512,
"dimFeedforward": 2048,
"numLayers": 6,
"dropout": 0.1
},
{
"type": "dense",
"units": 256,
"activation": "relu"
},
{
"type": "dropout",
"rate": 0.3
},
{
"type": "dense",
"units": 10,
"activation": "softmax"
}
],
"optimizer": {
"type": "adam",
"learningRate": 0.001,
"beta1": 0.9,
"beta2": 0.999
},
"loss": "categorical_crossentropy",
"metrics": ["accuracy", "precision", "recall"]
}
EOF
# Post-edit hook
npx claude-flow@alpha hooks post-edit --file "neural/configs/architecture.json" --memory-key "neural/architecture"
# Notify coordination
npx claude-flow@alpha hooks notify --message "Neural architecture configured: Transformer with 6 encoder layers"
flow-nexus-neural Actions:
# Deploy neural nodes to cluster
mcp__flow-nexus__neural_node_deploy {
"cluster_id": "$CLUSTER_ID",
"node_type": "worker",
"model": "large",
"template": "nodejs",
"autonomy": 0.8,
"capabilities": ["training", "inference", "validation"]
}
# Deploy parameter server
mcp__flow-nexus__neural_node_deploy {
"cluster_id": "$CLUSTER_ID",
"node_type": "parameter_server",
"model": "xl",
"template": "nodejs",
"autonomy": 0.9,
"capabilities": ["parameter_sync", "gradient_aggregation"]
}
# Deploy validator nodes
for i in {1..2}; do
mcp__flow-nexus__neural_node_deploy {
"cluster_id": "$CLUSTER_ID",
"node_type": "validator",
"model": "base",
"template": "nodejs",
"autonomy": 0.7,
"capabilities": ["validation", "benchmarking"]
}
done
# Connect nodes based on mesh topology
mcp__flow-nexus__neural_cluster_connect {
"cluster_id": "$CLUSTER_ID",
"topology": "mesh"
}
# Store node information
npx claude-flow@alpha memory store --key "neural/nodes-deployed" --value "4"
cicd-engineer Actions:
# Create training script
cat > neural/scripts/train.py << 'EOF'
#!/usr/bin/env python3
import json
import sys
from datetime import datetime
def load_config(path):
with open(path, 'r') as f:
return json.load(f)
def prepare_dataset(config):
# Datas