The process in which individuals, having the potential to develop any of several distinct developmental paths, have their individual developmental fate determined in response to environmental and/or genetic cues. Individuals with distinct developmental fates perform different functions in a colony of social insects.