The differentiation into queens and workers (which are both female), and different castes of workers, is influenced in some species by the food the larvae get. Genetic influences, and the control of gene expression by the feeding are complex. The determination of caste is a major subject of research.