Abstract: | Quantum computers promise to solve finite-temperature properties of quantum many-body systems, which is generally challenging for classical computers due to high computational complexities. Here, we report experimental preparations of Gibbs states and excited states of Heisenberg $XX$ and $XXZ$ models by using a 5-qubit programmable superconducting processor. In the experiments, we apply a hybrid quantum-classical algorithm to generate finite temperature states with classical probability models and variational quantum circuits. We reveal that the Hamiltonians can be fully diagonalized with optimized quantum circuits, which enable us to prepare excited states at arbitrary energy density. We demonstrate that the approach has a self-verifying feature and can estimate fundamental thermal observables with a small statistical error. Based on numerical results, we further show that the time complexity of our approach scales polynomially in the number of qubits, revealing its potential in solving large-scale problems. |