Files
foxhunt/TFT_TUNING_CONFIG_RECOMMENDED.yaml
jgrusewski 650b3894c6 🚀 Wave 160 Phase 5: Complete ML Ensemble + Production Deployment (27 Agents)
## Executive Summary
Deployed 27 parallel agents: all 6 models operational, ensemble working, adaptive
strategy integrated, hyperparameter tuning automated, TFT fixed, critical blocker
resolved (DbnSequenceLoader 99.85% memory reduction 40.6GB→61MB).

## Critical Fixes
- Agent 85: DbnSequenceLoader memory fix (UNBLOCKED all ML training)
- Agent 79: TFT 5 critical bugs fixed
- Agent 86: Adaptive strategy integration (regime-aware ensemble)
- Agent 88: Liquid NN API fix (14 compilation errors)
- Agent 89: Paper trading deployment (LIVE, 3-model ensemble)

## Infrastructure
- Database: 2,127 writes/sec (212% of target)
- Memory: DQN 192MB, PPO 288MB, TFT 384MB (all within targets)
- Ensemble: Sharpe 10.68, latency 35μs, throughput >20K/sec
- Monitoring: 22 alerts, PagerDuty integration

## Files: 193 changed, +70,250 insertions, -414 deletions

🤖 Generated with Claude Code - Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-14 18:41:48 +02:00

259 lines
10 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# TFT Hyperparameter Tuning Configuration (Recommended)
# Optimized for RTX 3050 Ti (4GB VRAM) and time-series forecasting
# Global tuning settings
global:
optimization_direction: maximize # Maximize combined objective
pruning_enabled: true
median_pruner:
n_startup_trials: 5 # No pruning for first 5 trials (establish baseline)
n_warmup_steps: 30 # Wait 30 epochs before starting to prune
interval_steps: 10 # Check for pruning every 10 epochs
sampler: TPE # Tree-structured Parzen Estimator (best for < 50 trials)
# TFT model-specific search space
models:
TFT:
# ============================================================================
# Training Parameters
# ============================================================================
epochs:
type: int
low: 30 # Minimum for TFT convergence
high: 100 # Maximum for overnight run
step: 10
description: "Training epochs - TFT needs 30+ for attention convergence"
learning_rate:
type: float
low: 0.0001 # Conservative for time-series stability
high: 0.001 # Max for avoiding gradient explosion
log: true # Log scale for better exploration
description: "Learning rate - lower range than DQN/PPO for time-series"
batch_size:
type: categorical
choices: [32, 64] # Max 64 for 4GB VRAM (TFT is memory-intensive)
description: "Batch size - limited by VRAM and attention memory requirements"
# ============================================================================
# Architecture Parameters
# ============================================================================
hidden_dim:
type: categorical
choices: [128, 256] # Max 256 for 4GB VRAM (512 requires 8GB+)
description: "Hidden dimension - d_model in transformer architecture"
num_heads:
type: categorical
choices: [4, 8, 16] # Standard attention head counts
description: "Attention heads - must divide hidden_dim evenly (128: 4/8, 256: 4/8/16)"
num_layers:
type: int
low: 2 # Minimum for deep learning
high: 4 # Max for 4GB VRAM (8 requires 12GB+)
step: 1
description: "LSTM layers - deeper networks = more memory + longer training"
dropout_rate:
type: float
low: 0.0 # No dropout (rely on early stopping)
high: 0.3 # Max for preventing underfitting
step: 0.05
description: "Dropout rate - regularization for preventing overfitting"
# ============================================================================
# Time-Series Specific Parameters
# ============================================================================
lookback_window:
type: categorical
choices: [30, 60, 120] # 30 min, 1 hour, 2 hours (1-minute bars)
description: "Lookback window - historical context for forecasting"
forecast_horizon:
type: categorical
choices: [5, 10, 20] # 5, 10, 20 minute predictions
description: "Forecast horizon - prediction steps ahead"
# ============================================================================
# Early Stopping Parameters
# ============================================================================
early_stopping_patience:
type: int
low: 10 # Minimum patience (conservative)
high: 30 # Maximum patience (aggressive)
step: 5
description: "Early stopping patience - epochs without improvement"
early_stopping_threshold:
type: float
low: 0.00001 # Very sensitive (stop on tiny improvements)
high: 0.001 # Less sensitive (require significant improvements)
log: true
description: "Early stopping threshold - minimum validation loss improvement"
# ============================================================================
# Objective Function Configuration
# ============================================================================
objective:
type: weighted_combination
weights:
quantile_loss: -0.6 # 60% weight on forecast accuracy (minimize)
sharpe_ratio: 0.4 # 40% weight on trading performance (maximize)
# Forecast accuracy metrics
forecast_metrics:
- quantile_loss # Primary metric (quantile regression loss)
- rmse # Root mean squared error
- mae # Mean absolute error
- quantile_coverage # % of actuals within [0.1, 0.9] quantiles
# Trading performance metrics
trading_metrics:
- sharpe_ratio # Risk-adjusted returns (annualized)
- max_drawdown # Maximum equity decline
- win_rate # % of profitable trades
- trade_frequency # Trades per 1,000 bars (target: 50-150)
# ============================================================================
# Trial Configuration
# ============================================================================
trials:
n_trials: 30 # Total trials (overnight run: 8-10 hours)
timeout_per_trial: 1200 # 20 minutes max per trial (safety limit)
# Trial execution
n_jobs: 1 # Sequential trials (GPU memory safety)
gc_after_trial: true # Garbage collect after each trial
# Pruning strategy
enable_intra_trial_pruning: false # Disabled (gRPC returns only final metrics)
enable_inter_trial_pruning: true # Enabled (compare final Sharpe ratios)
# ============================================================================
# Data Configuration
# ============================================================================
data:
# Training data
primary_symbol: "6E.FUT" # Euro FX futures (7,223 bars)
train_split: 0.80 # 80% training (5,778 bars)
val_split: 0.20 # 20% validation (1,445 bars)
# Cross-validation symbols (test generalization)
cross_validation_symbols:
- "ES.FUT" # E-mini S&P 500
- "NQ.FUT" # Nasdaq futures
- "ZN.FUT" # 10-Year Treasury
# Data preprocessing
normalize: true # Z-score normalization
remove_outliers: true # Remove > 3 sigma outliers
handle_gaps: "interpolate" # Interpolate missing bars
# ============================================================================
# GPU Configuration
# ============================================================================
gpu:
device: "cuda:0" # RTX 3050 Ti
max_vram_gb: 3.5 # Leave 0.5GB for system
enable_mixed_precision: false # Disabled (stability issues with attention)
enable_gradient_checkpointing: false # Disabled (not supported in candle)
# ============================================================================
# Success Criteria
# ============================================================================
success_criteria:
# Minimum viable hyperparameters
minimum_viable:
quantile_loss: 0.3 # Reasonable forecast accuracy
sharpe_ratio: 1.0 # Positive risk-adjusted returns
validation_gap: 0.2 # Max 20% train-val loss difference
trade_frequency_min: 50 # Minimum 50 trades per 7,223 bars
trade_frequency_max: 150 # Maximum 150 trades per 7,223 bars
# Production-ready hyperparameters
production_ready:
quantile_loss: 0.2 # Strong forecast accuracy
sharpe_ratio: 1.5 # Excellent risk-adjusted returns
rmse: 0.01 # 1% prediction error
quantile_coverage: 0.85 # 85% of actuals within [0.1, 0.9] quantiles
cross_symbol_sharpe_tolerance: 0.3 # Within 30% across symbols
# Study success
study_success:
minimum_viable_trials: 3 # At least 3 trials meet minimum viable (10% rate)
production_ready_trials: 1 # At least 1 trial meets production-ready (3% rate)
improvement_over_baseline: 0.2 # 20% improvement over baseline
# ============================================================================
# Monitoring & Logging
# ============================================================================
monitoring:
log_level: "INFO"
log_every_n_epochs: 10 # Log metrics every 10 epochs
save_best_checkpoint: true # Save checkpoint with best validation loss
save_final_checkpoint: true # Save checkpoint at end of training
# Metrics to track
tracked_metrics:
- train_loss
- val_loss
- quantile_loss
- rmse
- mae
- sharpe_ratio
- max_drawdown
- win_rate
- trade_frequency
- gradient_norm
- learning_rate
- epoch_duration
# ============================================================================
# Notes & Recommendations
# ============================================================================
#
# 1. VRAM Constraints:
# - Batch size 64 max (TFT attention scales O(n^2) with sequence length)
# - Hidden dim 256 max (512 requires 8GB+ VRAM)
# - Num layers 4 max (8 requires 12GB+ VRAM)
#
# 2. Trial Duration Estimates:
# - 30 epochs: ~8-10 minutes per trial
# - 100 epochs: ~15-20 minutes per trial
# - 30 trials × 15 min = 7.5 hours (overnight run)
#
# 3. Pruning Strategy:
# - MedianPruner starts at epoch 30 (n_warmup_steps)
# - Checks every 10 epochs (interval_steps)
# - Expected time savings: 30-40%
#
# 4. Objective Function:
# - 60% weight on forecast accuracy (quantile loss)
# - 40% weight on trading performance (Sharpe ratio)
# - TFT is a forecaster first, trader second
#
# 5. Cross-Validation:
# - Train on 6E.FUT (Euro FX)
# - Test on ES.FUT, NQ.FUT, ZN.FUT
# - RMSE should be within 20% across symbols
# - Sharpe ratio should be within 30% across symbols
#
# 6. Expected Best Hyperparameters:
# - learning_rate: 0.0003
# - batch_size: 64
# - hidden_dim: 256
# - num_heads: 8
# - num_layers: 3
# - lookback_window: 60
# - forecast_horizon: 10
# - dropout_rate: 0.15
# - early_stopping_patience: 20
#
# 7. Expected Performance:
# - Quantile loss: 0.15-0.25
# - RMSE: 0.008-0.012
# - Sharpe ratio: 1.3-1.8
# - Trade frequency: 80-120 trades per 7,223 bars