The work demonstrates the powerful role of machine learning techniques in the on-the-fly ab initio polariton dynamics. By using the machine learning model in this work, if one electronic structure calculation method can provide the molecular dipoles, we can in principle employ it in the polariton dynamics simulations using any MQC methods. This opens the possibility of simulating the polariton dynamics with the excitedstate electronic structure calculation methods that can treat more complex molecular systems, such as algebraic diagrammatic construction method to the second order [ADC(2)] 74,75 or time-dependent density functional theory (TD-DFT). Finally, although only a single molecule and a single cavity mode are considered in this work, we can extend the machine learning model to simulate collective molecules inside the cavity with multiple cavity modes if we can get all the molecular properties (energies, dipoles, NACs) with machine learning techniques. This will be the future direction of the current work. We envision that the machine learning model for construction dipoles and their derivatives presented in this work will benefit the quantum dynamics community aiming at using ab initio simulations to investigate polariton dynamics in realistic molecule-cavity hybrid systems.