A recovering cigarette smoker finds herself in a place that triggers strong associations with smoking and is sorely tempted to light up. But what if artificial intelligence could become an effective partner with would-be quitters, identifying environments predictive of smoking and intervening in the nick of time to nip that craving in the bud? A study has found a deep learning approach may be able to do that, recognizing locations predictive of smoking and triggering "just-in-time adaptive cessation interventions." It could also help optimize smokers' environments during cessation attempts and, more broadly, analyze the environmental stimuli of other behaviors that need modification. The deep-learning approach successfully differentiated environments that participants designated as smoking or nonsmoking with a mean area under the curve (AUC) of 0.840 (standard deviation, 0.024) (accuracy 76.5%; standard deviation 1.6%), a performance comparable to that of human smoking-cessation experts.