On the advantages of stochastic encoders