Abstract. 1. Many moth and butterfly larvae are gregarious early in development, but become solitary in late instars. This ontogenetic variation in behaviour is probably the result of temporal changes in the costs and benefits associated with gregariousness. This study provides observational and experimental evidence that, in one particular moth species, a series of different ecological factors influence larval behaviour at different times during development.
2. Field observations show that young caterpillars of the limocodid Doratifera casta form large aggregations while foraging, but that mature larvae are largely solitary.
3. A field experiment revealed that individual first to third instar larvae in larger groups develop more rapidly, but that group size had no detectable influence on survival. The developmental advantage associated with gregariousness is affected by host plant species, but not by predator exclusion, suggesting that group living in these cryptic early instar larvae promotes feeding facilitation, but does not provide individuals with protection from natural enemies.
4. Laboratory experiments revealed that aposematic fourth instar caterpillars in large groups were less likely to be attacked by a generalist insect predator than those in small groups.
5. Field observations provided no evidence that group living affects body temperature, suggesting that microclimatic factors do not favour gregariousness in this species.
6. It is concluded that gregariousness in D. casta confers at least two different advantages on larvae at different stages early in development, but that these advantages disappear, or are outweighed by costs associated with intraspecific competition, in final instars.