Duality Principles for Modern ML