Spatiotemporal variability in floral resources can have ecological and evolutionary consequences for both plants and the pollinators on which they depend. Seldom, however, can patterns of flower abundance and visitation in the field be linked with the behavioral mechanisms that allow floral visitors to persist when a preferred resource is scarce. To explore these mechanisms better, we examined factors controlling floral preference in the hawkmoth Manduca sexta in the semiarid grassland of Arizona. Here, hawkmoths forage primarily on flowers of the bat-adapted agave, Agave palmeri, but shift to the moth-adapted flowers of their larval host plant, Datura wrightii, when these become abundant. Both plants emit similar concentrations of floral odor, but scent composition, nectar, and flower reflectance are distinct between the two species, and A. palmeri flowers provide six times as much chemical energy as flowers of D. wrightii. Behavioral experiments with both naïve and experienced moths revealed that hawkmoths learn to feed from agave flowers through olfactory conditioning but readily switch to D. wrightii flowers, for which they are the primary pollinator, based on an innate odor preference. Behavioral flexibility and the olfactory contrast between flowers permit the hawkmoths to persist within a dynamic environment, while at the same time to function as the major pollinator of one plant species.flower visitation ͉ foraging behavior ͉ moth ͉ pollination A bundance and composition of flower species are fundamental aspects of pollination biology, and both can change over a pollinator's lifetime. For any nectar or pollen forager, the ability to discriminate, learn, and switch among flowers in the face of an ever-changing environment is critically important. For example, availability of floral resources at a landscape scale can constrain the size (1) and behavior (2) of a population of floral visitors (3). Unfortunately, aside from research on social bees (e.g., Apis mellifera, Bombus spp.), our understanding of mechanisms controlling nectar foraging by pollinators is limited. Whereas observational studies of flower visitation (reviewed in ref. 4) and proportionally fewer studies of the effects of changing flower composition on foraging (5) have been conducted (6), the causal mechanisms controlling floral visitation remain unclear and seldom can be demonstrated from the observed correlations. Thus, there remains a fundamental gap between the processes that occur in the field and the underlying behavioral mechanisms mediating those interactions.Nectar foraging by insects involves a suite of behaviors, both innate and learned. Much of our understanding of flower choice and cognition comes from work with generalist honey bees (Apis mellifera) and bumble bees (Bombus spp.), for which learning is a critical component. For instance, honey bee workers exhibit innate color preferences, but when trained on flowers of alternative colors, the preference is extinguished (7). Learning permits individual bees the flexibility to fo...