In some aspects, polarization of a spin ensemble can be increased using cavity-based techniques. A magnetic resonance imaging (MRI) system includes a cavity and a resonator. The cavity is adapted to interact with a spin ensemble in an imaging subject in a static magnetic field. The resonator is adapted to generate an interaction between the cavity and the spin ensemble that increases polarization of the spin ensemble. In some implementations, the spin ensemble achieves a polarization that is higher than its thermal equilibrium polarization.