The lateral hypothalamic (LH) projection to the ventral tegmental area (VTA) has been linked to reward processing, but the computations within the LH-VTA loop that give rise to specific aspects of behavior have been difficult to isolate. We show that LH-VTA neurons encode the learned action of seeking a reward, independent of reward availability. In contrast, LH neurons downstream of VTA encode reward-predictive cues and unexpected reward omission. We show that inhibiting the LH-VTA pathway reduces "compulsive" sucrose seeking but not food consumption in hungry mice. We reveal that the LH sends excitatory and inhibitory input onto VTA dopamine (DA) and GABA neurons, and that the GABAergic projection drives feeding-related behavior. Our study overlays information about the type, function, and connectivity of LH neurons and identifies a neural circuit that selectively controls compulsive sugar consumption, without preventing feeding necessary for survival, providing a potential target for therapeutic interventions for compulsive-overeating disorder.