A duality analysis on stochastic partial differential equations