International audienceThis paper is about derivatives techniques and their composition for semi-numerical models. Techniques such as symbolic derivation and automatic differentiation are addressed. All techniques are illustrated for the gradient based optimization of a magnetic nano switch