The second approach, called Pathwise learning, is inspired by [1]}, where the authors compute the conditional expectation of a payoff by using the Feynman-Kac formula to derive a pathwise control variate corresponding to the hedging strategy. In their work, the derivative of the conditional expectation value, present in the hedging integral, is approximated by a neural network and optimized so as to minimize the variance of the conditional expectation estimator. This approach is analogous to the one derived in [2]}, with the addition of machine learning techniques. In our case, given the approximation of the stochastic control associated to the PDE, a martingale representation of the payoff is derived on optimally controlled trajectories. Our first pathwise method, called Pathwise martingale learning, uses this martingale representation to train the value and the first derivative of a neural network. This method is also in the spirit of the deep BSDE method of [3]}, but the minimization of our loss function provides directly an approximation of the solution and its gradient on the space-time domain.
Our second method, called Pathwise differential learning, considers furthermore the derivative of this martingale representation, computed by automatic differentiation, which gives another loss function to be minimized in order to train neural networks for approximating the value function and its first and second derivatives. Such differential representation has been also considered in the recent paper [4]} for designing a deep learning scheme with one-step loss functions as in the deep backward approach in [5]} for solving forward backward SDEs with new estimation and error control of the \(Z\)  process.
Actually, the addition of this derivative loss function permits a better approximation of the terminal condition of the PDE and improves the overall approximation of the PDE solution's value and derivatives on the entire domain.
