Eliminate the entire mixed_precision runtime indirection layer: - Delete crates/ml-core/src/mixed_precision.rs (training_dtype, ensure_training_dtype, align_dim_for_tensor_cores) - Inline ~100 call sites across 130 files to constants: training_dtype(&device) → candle_core::DType::BF16 ensure_training_dtype(x) → x.to_dtype(candle_core::DType::BF16) align_dim_for_tensor_cores(x, &device) → (x + 7) & !7 - Remove re-exports from ml-dqn, ml-supervised, ml lib.rs - Clean config/toml/json/shell references No CPU/Metal training path exists — BF16 is the only dtype. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
126 lines
4.9 KiB
TOML
126 lines
4.9 KiB
TOML
# ML Model Parameters Configuration
|
|
# Centralized configuration for all AI/ML model parameters
|
|
|
|
[dqn]
|
|
# Deep Q-Network parameters
|
|
state_size = 50 # Market features input size
|
|
action_size = 3 # Buy, Sell, Hold
|
|
hidden_sizes = [256, 256] # Hidden layer dimensions
|
|
learning_rate = 0.001 # Learning rate for training
|
|
gamma = 0.99 # Discount factor for future rewards
|
|
target_update_freq = 1000 # Target network update frequency
|
|
dropout_rate = 0.1 # Dropout rate for regularization
|
|
memory_size = 100000 # Replay buffer capacity
|
|
batch_size = 32 # Training batch size
|
|
|
|
[dqn.hft_optimized]
|
|
# HFT-specific optimized parameters
|
|
state_size = 40 # Reduced feature set for speed
|
|
action_size = 3 # Buy, Sell, Hold
|
|
hidden_sizes = [128, 128] # Smaller networks for latency
|
|
learning_rate = 0.0005 # Lower learning rate for stability
|
|
gamma = 0.95 # Lower discount for HFT (shorter horizon)
|
|
target_update_freq = 500 # More frequent target updates
|
|
dropout_rate = 0.05 # Lower dropout for HFT
|
|
memory_size = 50000 # Smaller buffer for recent data focus
|
|
batch_size = 64 # Larger batches for stable gradients
|
|
|
|
[agent]
|
|
# DQN Agent parameters
|
|
epsilon = 1.0 # Initial exploration rate
|
|
epsilon_min = 0.01 # Minimum exploration rate
|
|
epsilon_decay = 0.995 # Exploration decay rate
|
|
min_replay_size = 1000 # Minimum samples before training
|
|
|
|
[agent.hft_optimized]
|
|
# HFT-specific agent parameters
|
|
epsilon = 0.3 # Lower initial exploration for HFT
|
|
epsilon_min = 0.001 # Very low minimum exploration
|
|
epsilon_decay = 0.9995 # Slower decay for stable learning
|
|
min_replay_size = 2000 # More samples before training
|
|
|
|
[mamba]
|
|
# MAMBA model parameters
|
|
model_dim = 768 # Model dimension
|
|
state_size = 64 # State space size
|
|
conv_kernel = 4 # Convolution kernel size
|
|
expand_factor = 2 # Expansion factor
|
|
dt_rank = "auto" # Delta time rank
|
|
|
|
[liquid]
|
|
# Liquid AI model parameters
|
|
model_type = "LFM1B" # Model type (LFM1B, LFM3B, LFM40B, Custom)
|
|
hidden_size = 768 # Hidden layer size
|
|
num_layers = 12 # Number of transformer layers
|
|
num_heads = 12 # Number of attention heads
|
|
intermediate_size = 3072 # Feed-forward intermediate size
|
|
|
|
[tft]
|
|
# Temporal Fusion Transformer parameters
|
|
hidden_size = 128 # Hidden layer size
|
|
num_encoder_layers = 2 # Number of encoder layers
|
|
num_decoder_layers = 2 # Number of decoder layers
|
|
num_heads = 8 # Number of attention heads
|
|
dropout_rate = 0.1 # Dropout rate
|
|
attention_dropout = 0.1 # Attention dropout rate
|
|
|
|
[tggn]
|
|
# Temporal Graph Generation Network parameters
|
|
hidden_size = 256 # Hidden layer size
|
|
num_layers = 4 # Number of graph layers
|
|
num_heads = 8 # Number of attention heads
|
|
edge_dim = 64 # Edge feature dimension
|
|
max_nodes = 1000 # Maximum nodes in graph
|
|
|
|
[nlp]
|
|
# NLP model parameters
|
|
model_type = "FinBERT" # Model type (BERT, RoBERTa, DistilBERT, FinBERT, Custom)
|
|
hidden_size = 768 # Hidden size
|
|
num_layers = 12 # Number of layers
|
|
num_heads = 12 # Number of attention heads
|
|
max_sequence_length = 512 # Maximum sequence length
|
|
vocab_size = 30522 # Vocabulary size
|
|
|
|
[inference]
|
|
# Inference parameters
|
|
max_latency_us = 100 # Maximum inference latency target
|
|
inference_threads = 8 # Number of inference threads
|
|
batch_size = 32 # Batch size for batch inference
|
|
warmup_iterations = 100 # Model warmup iterations on startup
|
|
enable_gpu = true # Enable GPU acceleration
|
|
device_id = 0 # CUDA device ID
|
|
memory_pool_mb = 1024 # GPU memory pool size
|
|
|
|
|
|
[model_paths]
|
|
# Model file paths
|
|
models_dir = "./models"
|
|
venue_selection = "./models/venue_selection.onnx"
|
|
risk_assessment = "./models/risk_assessment.onnx"
|
|
sentiment_analysis = "./models/sentiment.onnx"
|
|
|
|
[model_configs]
|
|
# Model type configurations
|
|
venue_selection_type = "onnx"
|
|
venue_selection_input_size = 50
|
|
venue_selection_output_size = 10
|
|
risk_assessment_type = "onnx"
|
|
risk_assessment_input_size = 30
|
|
risk_assessment_output_size = 1
|
|
sentiment_analysis_type = "onnx"
|
|
sentiment_analysis_input_size = 512
|
|
sentiment_analysis_output_size = 3
|
|
|
|
[normalization]
|
|
# Feature normalization parameters
|
|
enable_normalization = true
|
|
means = [] # Will be populated during training
|
|
stds = [] # Will be populated during training
|
|
min_vals = [] # Will be populated during training
|
|
max_vals = [] # Will be populated during training
|
|
|
|
[validation]
|
|
# Model validation parameters
|
|
clamp_min = -1000.0 # Minimum value clamp
|
|
clamp_max = 1000.0 # Maximum value clamp
|
|
finite_check = true # Check for NaN/Inf values |