Learning What to Trust: Bayesian Prior-Guided Optimization for Visual Generation