Anti-Stokes scattering occurs when an incident photon interacts with a molecule that is already in an excited vibrational state. The photon gains energy from the molecule, resulting in a scattered photon with higher energy. The molecule, in turn, transitions to a lower vibrational state. This is less common compared to Stokes scattering because it requires the molecule to be in an excited state initially.