  Efficient sampling from a classical Gibbs distribution is an important
computational problem with applications ranging from statistical physics over
Monte Carlo and optimization algorithms to machine learning. We introduce a
family of quantum algorithms that provide unbiased samples by preparing a state
encoding the entire Gibbs distribution. We show that this approach leads to a
speedup over a classical Markov chain algorithm for several examples including
the Ising model and sampling from weighted independent sets of two different
graphs. Our approach connects computational complexity with phase transitions,
providing a physical interpretation of quantum speedup. Moreover, it opens the
door to exploring potentially useful sampling algorithms on near-term quantum
devices as the algorithm for sampling from independent sets on certain graphs
can be naturally implemented using Rydberg atom arrays.
