Gasoline compression ignition (GCI) engines are considered an attractive alternative to traditional spark-ignition and diesel engines. In this work, a Machine Learning-Grid Gradient Ascent (ML-GGA) approach was developed to optimize the performance of internal combustion engines. ML offers a pathway to transform complex physical processes that occur in a combustion engine into compact informational processes. The developed ML-GGA model was compared with a recently developed Machine Learning-Genetic Algorithm (ML-GA). Detailed investigations of optimization solver parameters and variable limit extension were performed in the present ML-GGA model to improve the accuracy and robustness of the optimization process. Detailed descriptions of the different procedures, optimization tools, and criteria that must be followed for a successful output are provided here. The developed ML-GGA approach was used to optimize the operating conditions (case 1) and the piston bowl design (case 2) of a heavy-duty diesel engine running on a gasoline fuel with a research octane number (RON) of 80. The ML-GGA approach yielded >2% improvements in the merit function, compared with the optimum obtained from a thorough computational fluid dynamics (CFD) guided system optimization. The predictions from the ML-GGA approach were validated with engine CFD simulations. This study demonstrates the potential of ML-GGA to significantly reduce the time needed for optimization problems, without loss in accuracy compared with traditional approaches.