Model Training and Inference Optimization