Automatic differentiation methods allow to determine the Taylor expansion of any deterministic function. The generalization of these techniques for stochastic problems is not trivial. In this work we explore two approaches to extend automatic differentiation to stochastic processes, one based on reweighting (importance sampling) and another based on ideas from numerical stochastic perturbation theory using the hamiltonian formalism. A numerically implemented power series expansion is central for the extraction of the functional dependence on the parameter. The methods are tested and compared on a Bayesian inference model.