Introduction

The formation of groups in which conspecifics actively come together, engage in social interactions, and maintain proximity for durations that exceed brief aggressive encounters or mating events, is a widespread phenomenon observed from bacteria to humans (Allee 1938; Alexander 1974; Krause and Ruxton 2002; Frank 2007). These groups can be transient as with swarming locusts, or permanent as in social insect colonies (Modlmeier et al. 2019; Gross 2021). This gregariousness has various functions. Primate groom each other to reduce parasite load and bond, wolves form packs to hunt, penguins huddle to insulate against cold temperatures, fish form schools to defend against predators, mosquitoes swarm to mate and bacteria build and gather in biofilms to protect themselves from environmental conditions and share resources (Hill et al. 1976; Sullivan 1981; Pitcher 1983; Grueter et al. 2013; Escobedo et al. 2014; Ancel et al. 2015; Flemming et al. 2016; Baeshen 2022; De Dreu et al. 2023).

Groups often form in response to environmental stressors, including limited resources and threats from predators or parasites (Ostwald et al. 2022). Gregariousness helps individuals manage these issues and boosts their chances of reproduction. For example, group members support each other’s offspring by building nests, defending them, and aiding incubation, as seen in Seychelles Warblers (Komdeur 1994). Warder C. Allee highlighted the widespread occurrence of group living across animal groups, suggesting that animals benefit from being in appropriately sized groups (Allee 1938; Gascoigne et al. 2009). Indeed, very small groups may struggle with mate finding and predator pressure, while very large groups face resource competition and disease spread. This results in a curvilinear relationship between individual fitness and group size (Fig. 1), predicting the evolution of mechanisms that allow individuals to adapt their behaviour and physiology to group size. Indeed, small groups may use signals like sounds and pheromones to attract others, mitigating the downsides of a sparse population. Isolation, as seen in European earwigs, triggers stress and impacts health, pushing individuals to seek others (Kohlmeier et al. 2016). Conversely, large groups lead to social density-dependent behaviors like dispersal, aggression, and cannibalism, as observed in locusts (Gross 2021; Chang et al. 2023). The study of social behaviors and group dynamics is thus crucial for understanding how individuals interact and thrive within their social environment.

Fig. 1
figure 1

Hypothetical relationship between group size and individual fitness. Allee effects operate at a whole population level (i.e., across groups of the same species). Individuals often require the assistance of other individuals in order to persist. Being in an intermediate size group allows cooperation or facilitation among individuals as indicated in middle zone. Due to competition for resources, a population will experience a reduced overall growth rate at higher density, and the reverse holds true when the population density is low. Negative effects of both isolation and overcrowding are indicated (blue zones) (color figure online)

What causes the evolution of social groups? A key concept in the evolution of sociality—the degree to which individuals in a population form cooperative societies—is kin selection. This process based on indirect fitness benefits favors the spread of a new allele in a population if it helps relatives of the individual carrying the allele, not just the individual itself (Bourke 2014). This explains evolution and maintenance of cooperation and altruism in eusocial insects like ants, bees, and wasps, where sterile workers help raise the queen’s offspring, indirectly benefiting their gene transmission (Oster and Wilson 1979). Although more species form groups with non-relatives than with direct kin (Ostwald et al. 2022), group members are often more related to each other than to outsiders, making kin selection potentially relevant to all social systems (Kay et al. 2019, 2020). However, kin selection is not the only driver of gregariousness, as group formation also offers clear direct fitness benefits to individual group members such as protection against predators and mate finding (Wood and Ackland 2007). The effort to understand social evolution has led to classifying species from solitary to highly social, including altruistic behaviors like parental care and division of labor (Rehan and Toth 2015; Korb and Heinze 2016; Boomsma and Gawne 2018). This classification runs the risk of being misleading because it may give the impression that species classified as solitary are not gregarious. Instead, it reflects that the fundamental drivers of their social organization may not be strongly based on kin relations, their social interactions might be more competitive than cooperative or altruistic, or their sociality might be poorly understood.

In this review, we will bypass the semantics of the sociality nomenclature and focus on the mechanisms behind gregariousness. To explore these mechanisms, we focus on an organism whose social complexity has sometimes been underestimated; the vinegar fly Drosophila melanogaster. It has been studied extensively as a model organism in lab research since the early twentieth century, yet there remains a gap in understanding the ecological and evolutionary contexts of its social behaviors. Recent interest in using it as a model to dissect social functioning highlights the need for eco-evolutionary studies to understand the environmental pressures shaping gregariousness and the dynamics of cooperation and competition. To raise awareness that D. melanogaster’s lives in groups at all stages of its life cycle, we have structured our review of the social life of D. melanogaster from the eclosion of an adult fly to the production and development of its offspring (Fig. 2). Combining lab studies with natural observations, we speculate on the eco-evolutionary forces driving D. melanogaster sociality. While our analysis is speculative, we advocate for using the fruit fly as a model to enhance our understanding of the function, mechanisms, and evolution of sociality.

Fig. 2
figure 2

The social life cycle of Drosophila melanogaster. a. Eclosion and early adult stage Teneral flies (indicated by a yellow fly) can be born at varying social density (indicated by the brown adult flies) depending on time of the year. This stage lasts 1–2 days. b. Aggregation on food substrate. Flies are attracted to food substrates already inhabited by flies, but may be able to prefer certain group sizes. c. Lek mating. Flies often mate in large groups, where the composition of the group influence the mating of focal individuals. d. Females lay their eggs communally. e. Larval hatching from communal eggs approximately 24 h later. Larvae roam at first alone. f. After a couple of days of development, 2nd and 3rd instar larva starts aggregating. g. At the third instar larval stage, larvae form Cooperative foraging group and diff tunnels in the food. h: Larvae pupate next to each other forming pupal aggregates. This stage will last about 5 days (color figure online)

Eclosion and early adulthood

Adult fruit flies emerge from their pupal case with a not yet hardened cuticle, folded wings, and undeveloped pheromonal profile; it will take them a few days to reach sexual maturity. This period of behavioral and physiological maturation is critical to adult social functioning as it leads to the long-term modulation of neurohormonal pathways that regulate phenotypic plasticity at reproductive age (Neckameyer 1996; Bilen et al. 2013; Flaven-Pouchon et al. 2016; Lin et al. 2016; Zhang et al. 2021; Ji et al. 2023). Social isolation of young adults has consequences in later life including reduced and fragmented sleep, overconsumption of food, resistance to ethanol sedation, increased cellular stress, reduced life- and health spans, and heightened aggression (Brown et al. 2017; Agrawal et al. 2020; Eddison 2021; Li et al. 2021; Vora et al. 2022). Flies isolated in their early life are less sociable as adults, with lower rates of social interaction and clustering than group-housed flies (Schneider et al. 2012; Simon et al. 2012; Scott et al. 2018; Bentzur et al. 2021). These lab manipulations may model the detrimental effect of prolonged social isolation, whereby stress is felt as a drive to look for others, with sustained chronic stress eventually becoming damaging and thus maladaptive. However, they may also reflect an adaptation to the natural situation of flies eclosing when population density is low and where flies might have to experience smaller groups than those eclosing during peak population density (Behrman et al. 2015). In nature, social experience of newly eclosed flies fluctuates dramatically over time because of seasonal changes in population abundance. In the Northern hemisphere, for instance, wild D. melanogaster populations peak in abundance in early fall, tapering in November to resume growth in early summer (Bizzo et al. 2010; Bahder et al. 2016; Gleason et al. 2019). Flies born during a low demography phase might thus naturally trigger an adaptive stress response spurring them to locate other individuals.

Mechanisms of olfactory plasticity have been uncovered that may allow flies to adapt their behavior and physiology to fluctuating social density based on early-life social experience. For instance, males reared from eclosion in a dense social environment court females and gain mating once they reach sexual maturity more than males reared in isolation (Sethi et al. 2019). This early social experience-dependent effect is caused by activation of a population of Odorant Receptor Neurons (ORN) called Or47b ORNs by a fly pheromone—palmitoleic acid—during the early adult stage. Sensing palmitoleic acid at this stage increases the intracellular level of Ca2+/Calmodulin-dependent protein Kinase in Or47b ORNs, which activates CREB Binding Protein (dCBP), a chromatin modifier regulating histone acetylation. dCBP modifies the epigenetic state of the promoter of the fruitless (fru) gene in Or47b ORNs, making it more accessible to transcription factors (Sethi et al. 2019; Zhao et al. 2020). In parallel, Juvenile Hormone—a hormone with broad developmental functions in insects—binds to its receptors Methoprene-tolerant (Met) on the Or47b ORNs, which activates Met’s transcription factor binding to the fru promoter. This enhances fru expression leading to heightened expression of the FruM protein, a transcription factor that governs male sexual behavior (Billeter et al. 2006). FruM’s increased expression in Or47b ORNs in turn leads to upregulation of pickpocket, a gene encoding an ion channel. This ion channel makes OR47b ORNs more sensitive to fly pheromones, causing male flies who had social experience early in their adulthood to be more aroused by other flies compared to isolated ones (Ng et al. 2019). The functional significance of this social plasticity may be to allow males to adjust courtship intensity early based on competition risk, preparing for higher competitiveness at high population densities (Sethi et al. 2019).

Female flies may adapt to the problem of fluctuating population size using a similar mechanism. Females invest more resources in their offspring than males and have thus been selected to be choosey regarding the quality of their mating partners (Bateman 1948; Gowaty et al. 2012; Collet et al. 2014). However, choosiness can become costly if the availability of males that meet female criteria is low, e.g. at low population density early in the reproductive season or when environmental conditions result in low-quality males (Kokko and Mappes 2005). Under such conditions, high choosiness can delay the onset of female reproduction or entirely prevent females from acquiring sperm. Mating status-dependent selectivity, with females being unselective as virgins and increasing selectivity after the first mating, has been suggested as a solution to this problem (Kokko and Mappes 2005). Such post-mating shifts in selectivity can increase the likelihood of getting fertilized early in life without lowering offspring quality as most eggs will be fertilized with sperm from later males of higher quality. On a mechanistic level, this increase in selectivity is triggered by a post-mating increase in Juvenile Hormones levels that bind to OR47b ORNs and lower their sensitivity to its pheromonal ligand, palmitoleic acid (Kohlmeier et al. 2021). Thus, only high quality males that produce large amounts of palmitoleic acid will be selected for re-mating by already mated females. This mechanism functions as a safety net, allowing females to ensure early fertilization in case of low availability of high-quality males without lowering offspring quality.

The epigenetic mechanism linking early social experience with male competitive ability and female level of choosiness at reproductive age makes functional sense when seen in the light of D. melanogaster as a species whose social interactions are critical but rely on groups of fluctuating density. If the adaptive function of these early life experiences can be established, it will be further evidence that D. melanogaster’s evolution is strongly linked to group interactions.

Finding a communal substrate—colonizers and followers

In their natural or human-associated habitats, D. melanogaster are commonly found on fermenting/rotting substrates rich in yeast such as ripe fruits, alcoholic drinks, rising dough, and vinegar. The swarms of flies around such products are not the mere result of a common attraction to a food source, but is actively regulated by the deposition of aggregation pheromones. Demographic models (Lof et al. 2008) indicate that flies need a critical number of individuals to successfully establish a population, calling for aggregation mechanisms. Conversely, dispersal should increase as the population increases and local conditions deteriorate. If gregariousness is relevant to flies, these density-dependent effects should have resulted in the evolution of mechanisms that regulate the balance between aggregation and dispersal based on current and future social densities.

Laboratory experiments suggest that flies use social density as a cue to decide whether to disperse or remain at a location (Betini et al. 2013a, b, 2015). They also reveal that flies do not individually evaluate all available food resources in an environment. Instead, a “primer” fly explores the environment and signals the location of favorable food sources to other flies (Tinette et al. 2004). Contrary to the notion that flies are solitary and aggregate merely due to a common attraction to food, their aggregation is, in fact, actively regulated. Both male and female flies attract other flies by depositing pheromones into their environment, through their feces or, in the case of recently mated females, when ejecting pheromone-rich male ejaculate (Bartelt et al. 1985; Duménil et al. 2016; Keesey et al. 2016; Verschut et al. 2023). These pheromonal marks include attractive odorants such as methyl laurate, methyl myristate, methyl palmitate, cVA, in addition to several cuticular hydrocarbons (CHCs) (Dweck et al. 2015; Lin et al. 2015; Duménil et al. 2016; Keesey et al. 2016; Verschut et al. 2023). The first and best characterized of these pheromones is cis-Vaccenyl acetate (cVA), a fatty acid made in the male ejaculatory bulb (Butterworth 1969; Bartelt et al. 1985; Wertheim et al. 2006). It is transferred into the female uterus during mating and then ejected by the female on food substrates a few hours later (Laturney and Billeter 2016). Wind tunnel, as well as field trapping assays have shown that cVA attracts flies from a distance (Bartelt et al. 1985; Wertheim et al. 2006; Cazalé-Debat et al. 2019). That long range aggregation function of cVA is accompanied by a short range social interaction function, as cVA activates Odorant receptor neuron Or67d at only millimeters distance during social interactions (Taisz et al. 2023). To add to the complex and still confusing function of cVA, it not only attracts flies to a substrate but can also lead them to disperse. Initially, cVA attracts flies, but the arrival of too many males raises cVA concentrations locally leading to increased aggression and dispersal, reducing the number of flies in the area (Wang and Anderson 2010).

Aggregation exposes Drosophila to intraspecific competitors, harmful microorganisms that compete for resources, and larval parasitoids (Wertheim et al. 2006). Flies possess olfactory adaptation that allow them to actively avoid such factors. The odorant Geosmin produced by harmful bacteria is a strong repellent and an inhibitor of egg laying (Stensmyr et al. 2012). The parasitoid wasp pheromone Irridiomycin also blocks aggregation and egg-laying allowing flies to avoid location with parasitoids (Ebrahim et al. 2015). Aggregation pheromones can, however, be hijacked by bacteria, who trigger an immune response in flies that increases production of aggregation pheromone, hence attracting healthy flies that then become infected (Keesey et al. 2017). Taken together, these lab experiments indicate that gregariousness is regulated, at a distance, through pheromones with complex modes of functioning. This showcases D. melanogaster’s sophistication when forming groups and underscores the importance of social interactions in the evolution of this species.

Function of adult groups

Once aggregated on a substrate, adult flies experience the benefits, but also the costs, of being in the presence of others. The resulting groups appear to be adaptative to the problems of feeding on top of rotting fruits, exposure to predators and maximizing reproductive output and diversity. Lab studies have identified effects of the presence of others on multiple physiological and behavioral pathways that may reflect both cooperation and competition.

Strength in number and threat avoidance

Adult flies face predation from dragonflies, birds, and other diurnal predators. Being in a group helps dilute predation risk, thereby reducing predation stress on group members. For example, flies subjected to predation by dragonflies make more evasive turns when flying alone compared to when in a group. However, dragonflies are more likely to catch prey in groups than when isolated, seemingly targeting flies with the most predictable flight patterns (Combes et al. 2012). An indication that flies experience less stress in groups is their response to looming stimuli, which signal imminent danger, such as a quickly approaching predator. A solitary fly exposed to such a stimulus will freeze, possibly to become less noticeable to the predator. However, flies in groups freeze less often, showing reduced freezing behavior as the number of surrounding flies increases when faced with a looming stimulus (Ferreira and Moita 2020; Ferreira et al. 2022). A similar response is observed with exposure of flies at a feeding site to an overhead threat. Flies feeding in groups are less readily dispersed in response to this overhead threat than single flies, and also return to the food faster than single flies (Gibson et al. 2015). Therefore, it is plausible that flies behave like a selfish herd (Hamilton 1971), perceiving the presence of others as safety in numbers, reducing the need to become inconspicuous or disperse in the presence of a threat.

Group-mediated threat avoidance is also observed in the response to carbon dioxide (CO2), an odor found in the chemical mix released by stressed flies (Suh et al. 2004; Yost et al. 2021). A group of flies can collectively respond to CO2 without all individuals directly sensing it. Indeed, individual flies that detect CO2 start moving, as they encounter stationary flies, they touch them and these flies start moving in the opposite direction where they were touched (Ramdya et al. 2015). This causes flies to have a faster and higher reaction to aversive odours avoidance in groups compared to in isolation, showing the benefits of group membership to the individual. Interestingly, CO2 released by group members results in a memory increases with group size showing social facilitation (Muria et al. 2021).

The response to others in terms of threat reduction depends on individuals being at close distance. Inter-individual distance is an actively regulated process that involves higher order brain neurons in the Mushroom bodies, the serotonergic and dopaminergic system, probably relying on olfactory and visual input (Simon et al. 2012; Fernandez et al. 2017; Sun et al. 2020; Marcogliese et al. 2022). Adult flies exhibit non random network of social interactions, indicative of a functional role of group interactions (Schneider et al. 2012; Pasquaretta et al. 2016; Bentzur et al. 2021). Social network measures in groups of various sizes, show that flies regulate their interactive behaviour to group size and compensate for change in social density linked to increased space by modulating movement speed, suggesting that individuals are aware of the number and distance of others within their group (Ferreira and Moita 2020; Rooke et al. 2020). It is thus clear that flies have a sense of social distance and group size, which they use to modulate stress and social interactions.

Synchronisation

The ability to function as a group relies on behavioural synchronisation of the group members. Synchronization is a wide-spread phenomenon across eusocial hymenopterans. For instance, honey bee foragers use a socially entrained circadian clock to time their visits to flowers (Siehler et al. 2021). Leptothorax ants display colony-wide bursts of activity (Franks et al. 1990), potentially to increase spatial accessibility inside the nest (Doering et al. 2023). In the clonal raider ant, all mature individuals of a colony transition between a reproductive queen-like and a non-reproductive worker-like phase in a highly synchronized way triggered by larval chemical cues (Oxley et al. 2014). Synchrony among group members and mechanisms to regulate this synchronicity may thus indicate a cooperative function.

Adult D. melanogaster males isolated in constant darkness exhibit diverging phases of locomotor activities. However, when these isolated flies are connected through air flow to a group of flies exposed to light, their activity phases reset and synchronize with those of the light-exposed flies (Levine et al. 2012). This suggests an olfactory pathway that ensures activity synchronization among flies, providing further evidence of their adaptation to group living. Although the specific molecules that mediate this synchronization have not yet been identified, a biological clock is present in the pheromone glands of fruit flies, the oenocytes (Krupp et al. 2008). These oenocytes exhibit a daily cycle in clock gene expression that mirrors cycling in the pheromones they produce. The presence of other flies enhances the activity of clock genes in both the brain and oenocytes, leading to increased pheromonal production. The timing of this pheromonal clock is regulated by the central brain clock through the neuropeptide PDF, which is influenced by social interactions (Krupp et al. 2013). Thus, a neurohormonal pathway responds to social cues from nearby flies, altering clock gene expression in brain neurons and oenocytes, which results in a social-context-dependent change in pheromone production.

Reproducing in a group

That social context influences pheromone expression raises the question of whether these pheromones carry functional information about the social environment. This is observable in the mating behavior of D. melanogaster females when they encounter either homogeneous or genetically diverse groups of males. Theoretical models suggest that females gain indirect fitness benefits by producing genetically diverse offspring, as diversity among offspring increases chances of adaptation to unpredictable environments (Yasui 1998). This diversity can be achieved by females mating with multiple genetically diverse males and hence gaining diverse paternity for their offspring. Indeed, D. melanogaster females mate more frequently when genetically diverse males are present in their environment (Krupp et al. 2008, 2013; Billeter et al. 2012). Male flies produce more pheromones when around a diverse group of male flies (Krupp et al. 2008) and females who have a reduced sense of smell do not show an increased interest in mating in these diverse groups (Billeter et al. 2012), This suggests that females can sense male genetic diversity through their pheromones, which change depending on the diversity of the group, and modulate their mating rate. Given the phenomenon of last male sperm precedence, where the most recent male partner sires the majority of offspring, one might question whether an increased mating rate merely changes paternity without enhancing diversity. However, females evolved countermeasures to influence sperm competition. Firstly, females mating multiple times in quick succession can mitigate the effects of last male precedence, resulting in a more equitable distribution of paternity than with fewer matings (Billeter et al. 2012; Laturney et al. 2018). Secondly, Virgin females, being less selective (Kohlmeier et al. 2021), adjust their preferences and can manipulate sperm storage from their first mate based on the presence of more desirable males (Doubovetzky et al. 2023; Yun et al. 2023). This includes ejecting the ejaculate of the first mate sooner if high-quality males are available, hence reducing the storage of the first male’s sperm in favor of the second. Early ejection removes anti-aphrodisiac pheromones from the first ejaculate, making the female more attractive sooner (Laturney and Billeter 2016; Yun et al. 2023), and decreasing the stored sperm from the first male (Doubovetzky et al. 2023). These processes link social context to offspring production, highlighting the social influence on key reproductive traits in D. melanogaster.

While these interactions may appear competitive, the impact of group composition on genotype frequencies in future generations warrants exploration for potential indirect genetic benefits to group members. For instance, a change in genotype frequency in a group affects the range of immune responses, influencing the likelihood that a single disease can spread fast amongst individuals of that group. It also generates greater genetic diversity in the offspring, reducing the risk of inbreeding in the resulting population and the ensuing genetic disorders and reduced fertility. Focus on indirect benefits could uncover a level of cooperation within D. melanogaster groups not previously appreciated.

Another phenomenon that militates for the social nature of D. melanogaster’s reproduction is mate copying. D. melanogaster females can utilize social information by copying the mate choices of others, hence reducing the time and cost of selecting a suitable mate. Until recently, examples of mate choice copying were based on visual cues, be it artificial colours or morphological mutants (Mery et al. 2009; Danchin et al. 2018; Nöbel et al. 2018). A recent study shows that female can also use chemical cues for mate copying. A virgin female exposed to a mated “teacher” female will later select the same male genotype as that selected by the teacher mated at higher frequently than expected by chance (Mitchell et al. 2024). Although the virgin female had not observed the mate choice of her teacher, she was able to use chemical cues indicative of male genotype left by the male on the teacher to inform her mate choice (Mitchell et al. 2024). Flies can thus exploit social information through multiple sensory channels to make decisions, again offering support to complex social functions in D. melanogaster. Strikingly, these socially learnt mate choice can persist across generation, leading some to propose that populations of flies can establish cultures (Danchin et al. 2018).

Male–male competition: aggression and modulation of ejaculate transfer

Male–male competition is a salient aspect of social interactions in aggregated fruit flies. Males are hypothesized to fight each other to defend territory and gain access to mates. Interestingly, former opponents fight differently with each other than unfamiliar ones suggesting that outcomes of past aggressive encounters leads to establishments of hierarchical relationships between males (Yurkovic et al. 2006). That flies can remember the outcome of past social encounters shows that individuals within groups can recognize each other, which suggest the possibility of familiarity and reciprocity within Drosophila melanogaster social groups.

The competitive nature of males extends beyond physical encounters. Males raised with other males mate for longer than those who grew up alone and were only exposed to other males during mating. These isolated males also have shorter mating durations compared to those who mate without any other males around (Bretman et al. 2009, 2011; Kim et al. 2012). These mating durations are inversely proportional to the amount of sperm transferred, whereby males who grew up with other males respond to rival males by ejaculating less sperm, while males raised alone respond to the presence of rival males by increasing ejaculate size (Garbaczewska et al. 2013). Males also adapt seminal fluids content, a set of peptides in their ejaculate that modulates female fecundity and sexual receptivity, in their ejaculate to the presence of other males (Hopkins et al. 2019). This flexibility is adaptive because males that spend time with rivals before mating gain a significantly larger share of paternity (Bretman et al. 2009), and probably evolved as a response to fluctuating population density. Indeed, a male mating with a female in a low population density is less at risk of losing his ejaculate investment through her remating with another male, who will have precedence given last male sperm precedence, than a male who grew up in high population density. Given that females remate more when there are many males around (Gorter et al. 2016), males may benefit from reducing ejaculate investment per female and attempting as many matings as possible. This plasticity in response to others highlights once again that D. melanogaster evolved sophisticated mechanisms to navigate the costs and benefits of functioning within a group.

Communal egg-laying: female cooperation and competition

The nomenclature classifying the sociality of a species focuses on the shift from competition to cooperation, (Frank 2003). Characterizing D. melanogaster as a solitary species assumes that its social interactions are competitive in nature. Fruit flies might pay attention to others only because they are rivals and may actively associate with others for selfish reasons. While this is apparent in the physiological and behavioral responses of males to their social context discussed in “Male–male competition: aggression and modulation of ejaculate transfer” section, females display sophisticated responses to their social context that may be interpreted as cooperative.

Females show a preference for laying eggs alongside other females, which is an adaptive behavior due to positive density dependence at the larval stage, enhancing resource exploitation and survival chances for their offspring in larger groups (Wertheim et al. 2002a, b; Duménil et al. 2016; Bailly et al. 2023; Verschut et al. 2023). However, when environmental resources become scarce, these larval groups may shift to competition (Vijendravarma et al. 2013), illustrating both positive and negative effects of communal egg laying. This dynamic might explain why female flies, when choosing oviposition sites, evaluate both nutritional content and social cues (Duménil et al. 2016). They can assess social information through pheromones left by previous visitors, with quantities that increase linearly with visitor numbers (Verschut et al. 2023). Key pheromonal components include cVA and various fatty acid methyl esters for long-range attraction, and a variety of less volatile cuticular hydrocarbons, such as (Z)-7-tricosene (7-T) for close-range interactions, predominantly from males (Jallon 1984; Ferveur 2005; Grillet et al. 2006; Billeter et al. 2009; Farine et al. 2012; Laturney and Billeter 2016). Females are drawn to sites marked by males and mated females due to these cuticular hydrocarbons, whereas sites visited by virgin females lack this appeal (Lin et al. 2015; Duménil et al. 2016; Cazalé-Debat et al. 2019; Verschut et al. 2023). After mating, females carry significant amounts of cVA and 7-T, highlighting the importance of male-derived pheromones in signaling oviposition sites (Laturney and Billeter 2016). Females opt for oviposition sites marked by pheromone levels indicating a moderate number of previous visitors, avoiding areas with too low or high concentrations (Verschut et al. 2023). This nuanced choice is influenced by a combination of cVA, reflecting visitor numbers, and heptanal, a derivative of 7-Tricosene, acting as a co-factor regardless of dose. The detection of cVA and heptanal involves specific odorant receptor neurons, enabling a curvilinear egg-laying response to linearly increasing pheromone doses (Verschut et al. 2023), reminiscent of the density depend fitness curve shown in Fig. 1. Moreover, females consider larval pheromones, such as (Z)-9-octadecenoic acid ethyl ester, avoiding high-density larval areas. This indicates that females incorporate social signals from different developmental stages into their oviposition decisions (Mast et al. 2014; Zhang et al. 2023), demonstrating their attention to comprehensive social information.

Response to pheromones for communal egg-laying corresponds to a choice to join in sites where others are/have been versus laying eggs alone. Females also possess adaptation to egg laying once they have joined an egg-laying site/group. Females grouped with other flies advance onset of egg-laying to give a competitive advantage to their offspring—allowing them to first hatch and exploit finite resources—giving them a better chance of survival (Bailly et al. 2023). The presence of a group affects female oogenesis and egg-laying, and it does it in a density-dependent manner. These responses are not only competitive as females given the choice to lay eggs alone or in groups, prefer to do it in group. Females kept alone will show higher exploration of their surroundings than females already in a group, which we interpret as them looking to join a group. These responses to the presence of others are mediated by image-forming vision and are the result of the stimulation of the juvenile hormone pathway (Bailly et al. 2023). D. melanogaster females can also inhibit egg-laying when in a stressful environment. For instance, isolated females under light conditions have reduced oogenesis, ovulation and egg-laying (Bailly et al. 2023). These social density effects also have a connection to early life experiences. Females maintained in social isolation prior to mating lay significantly more fertilised eggs than females raised in groups, mirroring the effect of social context on sperm transfer in males (Fowler et al. 2022). The relevant cues for social density are sensed through direct contact with the non-egg deposits left behind by other females (Fowler et al. 2022). D. melanogaster females thus regulate egg-laying behaviour based both on early social experience and their immediate context through pheromone-mediated detection of adult and larval density, and visual motion cues. The complexity of sensory cues utilized by females for deciding where they lay their eggs once again illustrates the relevance that social experience must have had on the evolution of this species reproduction.

Aggregated eggs

The communal egg-laying behavior of females is in our opinion one of the main drivers of group formation by adults. Before we explain why, we need to explore the effect of communal egg laying on the eggs themselves. D. melanogaster eggs are found slightly buried directly in a food substrate (Yang et al. 2008; Bräcker et al. 2019). Eggs from many females are aggregated on the same spot. Aggregating eggs benefits egg survival. Females coat their eggs with pheromones including the female and species specific 7,11-HD pheromone and the aggregative pheromone cVA (Everaerts et al. 2018; Narasimha et al. 2019). This coating prevents the larvae that roam on the same substrate where the eggs are deposited from eating the egg, through a process termed chemical camouflage (Narasimha et al. 2019). This pheromone coating serves at least two other social functions. The first is that coating with cVA might make eggs another source of aggregation pheromones, thereby attracting more females to lay their eggs in the same space (Cazalé-Debat et al. 2019). Another social function has to do with the amount of cVA on an egg depending on its position in the egg-laying series; early eggs being covered with more cVA and later eggs with none. This influences male sexual behaviour later in life as male flies derived from eggs covered with low levels of cVA court mated females more intensely than males from eggs coated with high amounts. This suggests that courtship suppression involves a form of pre-imaginal conditioning, connected to pheromones deposited on the eggs (Everaerts et al. 2018). Once again, early life events connected with social cues affect later life demonstrating that social experience plays a fundamental role in determining individual behavior.

Larval cooperation and competition

Determining whether an individual’s behavior in a group is competitive or cooperative is challenging in laboratory settings, as key ecological factors driving group formation might be missing. The adult behaviors discussed so far occur under controlled conditions including constant food, temperature, humidity, and light, crucially without predators or interspecific competitors. Many of these factors have been introduced in laboratory settings to study the behavior of D. melanogaster larvae. These studies reveal that larvae work together to tackle challenges related to finding resources, avoiding predators, and competing with fungi.

Although D. melanogaster eggs are aggregated, larvae freshly hatched form these eggs graze individually on the surface of food substrates. From a starting population of dispersed early developmental stage larvae, larvae gradually aggregate from second to third instar (Durisko et al. 2014). This social transition is regulated by a decrease in expression of the Neuropeptide Y, which changes the relationship of larvae to food (Wu et al. 2003). Groups of larvae aggregate around soft food spots where they initiate burrowing, a behavior less frequent in single larvae (Durisko et al. 2014). Individuals in these groups come side-by-side vertically and dig an open-pit mine in the surface of food. By keeping close contact, they create a scaffold that prevents their mine shaft from collapsing, creating an environment in which they can feed relatively safely for longer due to better ventilation, and can keep air access to their posterior spiracles (Dombrovski et al. 2017). Here again, social plasticity is observed as a result of earlier experiences. The likelihood of clustering at later larvae stages is encoded in young larvae through visual learning of motion patterns, resulting later association with larvae with a similar motion pattern (Slepian et al. 2015). This learning is however not achieved in conditions of early overcrowding, resulting in lack of aggregation at later larval stages.

Similar to adults, larvae show density dependent plasticity in their aggregative and social behaviors allowing larvae to integrate into and benefit from social groups at beneficial densities, but not in conditions of overcrowding. One further aspect of this aggregative behavior represents a hallmark of cooperative behavior; a tendency to selectively associate with genetically related individuals. Indeed, larval aggregation is regulated by two pheromones emitted by D. melanogaster larvae, (Z)-5-tetradecenoic acid and (Z)-7-tetradecenoic acid, that attract conspecific but not sibling species (Mast et al. 2014). This recognition system may act to create same-species groups in wild conditions where multiple fly species exploit a common substrate. More convincingly in terms of classic argument for the evolution of cooperation, the presence of closely related kin leads to more frequent and larger feeding clusters, suggesting that kinship plays a role in facilitating cooperative behavior (Khodaei and Long 2019).

The cooperative function of the larval group goes beyond burrowing One other major benefit of aggregation is to disrupt the growth of fungal competitors. While yeasts is an essential food source for both larvae and adults (Wang et al. 2022), there is competition between moulds and Drosophila development (Wertheim et al. 2002b; Rohlfs 2005). In the presence of specific mould species, larval survival to the adult stage had a positive relationship with social density, typical of an Allee effect (Rohlfs et al. 2005). Larvae tend to aggregate more often on patches of food infected with fungal colonies and high densities and larger groups of larvae are more effective at suppressing fungal growth by eating their hyphae (Trienens et al. 2010, 2017; Trienens and Rohlfs 2020). This defense mechanism is one more example of cooperation between larvae. It is thus likely that the beneficial aspects of this larval cooperation is what drives females to aggregate to lay their eggs.

In a framework where individuals gain curvilinear benefits from group membership (Fig. 1), one last missing aspect is negative density-dependent effects. Indeed, larval groupings have costs when they overwhelm environmental carrying capacity. D. melanogaster larvae exhibit cannibalistic behavior when nutritionally challenged, consuming diets composed of larger conspecifics and their eggs (Ahmad et al. 2015; Kakeya and Takahashi 2021). This cannibalistic diet can support normal development from eggs to fertile adults. Additionally, 118 generations of experimental evolution under malnutrition showed an enhanced propensity towards cannibalism, suggesting its adaptive potential (Vijendravarma et al. 2013). This cannibalism is, however, subject to kin discrimination. Larvae preferentially approach and cannibalize unrelated eggs more frequently than kin eggs, suggesting that larvae avoid indirect fitness costs by avoiding eating those related to them (Khodaei and Long 2019).

Pupae

The last stage of D. melanogaster’s pre-adult development is metamorphosis. There again is a social dimension to this sessile developmental stage. Wandering third instar larvae use species-specific pheromones for selecting a pupariation site next to conspecifics. This creates different clusters of pupal species on one given fruit, reducing species mixing and concentrating same species pupae (Beltramí et al. 2012; Del Pino et al. 2014). About a third of the contacts were between intimately paired pupae (synapsis), suggesting social interactions during pupation (Ringo and Dowse 2012). The social function of this close contact remains to be investigated.

Conclusion

We hope that skeptics are persuaded of the presence of gregariousness and cooperative behaviors in D. melanogaster. That flies are social is substantiated by the many instances where individual flies adapt their behavior and physiology to others and function as part of a group instead of existing alone or only interacting to mate or fight. Although we find their designation as “solitary” counterintuitive (for a discussion see (Brenman-Suttner et al. 2020)), it is rooted in arguments about inclusive fitness theory and evolution of eusociality. Indeed, the eusocial insects did not evolve from groups of random individuals interacting with one another, but most likely from a very specific situation where daughters remained associated with their mother and helped her instead of starting their own reproduction (Wilson 1971; Chandra et al. 2018; Saleh and Ramírez 2019). This distinction between eusociality and social behaviors observed in D. melanogaster highlights the diverse evolutionary strategies for negotiating social living. Irrespective of their sociality classification, this species holds promise for addressing questions that have intrigued sociobiologists, offering a valuable model for unraveling the genetic, neural, and ecological foundations of social behavior. Insights from this research could reveal overarching principles of sociality relevant across species, enhancing our understanding of the trade-offs associated with group living. Below, we outline areas where D. melanogaster could serve as a key tool in exploring social phenomena and concepts.

In this review, we focused our exploration of D. melanogaster’s social life at the individual level. We also selected behavioral and physiological effects for which a function could be envisaged, in order to attempt to assign a cooperative or competitive function. These phenomena are waiting to be further dissected to understand their mechanistic basis to shed light on sociality. One is the biological effect of social isolation and social experience. In humans and most animals, prolonged social isolation is linked to early morbidity and psychiatric disorders, and the reverse holds true when individuals have a rich social life (Holt-Lunstad et al. 2015). As the number of social contacts has a genetic basis in both humans and flies (Scott et al. 2018; Bralten et al. 2021; Ike et al. 2023) and the genes that promote social distance are conserved between flies, mice and possibly humans (Ike et al. 2023), the fly might become a useful model for the effect of social interactions on health. For instance, tumor progression is slower when cancerous flies are kept with other cancerous flies, and tumor progression is faster when cancerous flies are in isolation or within a group of healthy individuals (Dawson et al. 2018). Other medically relevant phenomena, such as sleep and aging, are modulated by the group in flies (Li et al. 2021; Vora et al. 2022). The fly could also become a more commonly used model to explore mechanisms present in eusocial insects (Kayashima et al. 2012; Camiletti et al. 2014; Camiletti and Thompson 2016). For instance, cloning of ant genes into the D. melanogaster genome has been successfully used to identify ligands of ant Odorant Receptor genes (Pask et al. 2017; Slone et al. 2017) as subsequent techniques such as single sensillum recordings are much more routine and streamlined in flies than in other insects. Flies will have lower lifespan when isolated, but this is marginal compared to eusocial insects, who cannot survive out of a group, with ants dying as a result of oxidative stress following isolation (Koto et al. 2023). This suggests a potential continuum in the response to social isolation, from facultative group living in flies to obligatory group living in ants. Discovering a mechanism in D. melanogaster could inspire hypotheses about similar mechanisms in species with more pronounced effects of social isolation.

The use of flies as a model to study social effects goes beyond what is covered in this review. Strong evidence exists for group-level phenotypes in D. melanogaster, identified through social network analysis (Schneider et al. 2012; Jezovit et al. 2020, 2021). These social network properties differ between Drosophila species and appear to have been shaped by ecological differences (Jezovit et al. 2020). The heritability of social network structures, and the finding of a natural allelic variant underlying strain differences in social network properties, suggests these networks could facilitate adaptation at the group level in D. melanogaster (Schneider et al. 2012; Rooke et al. 2024). Future research will explore the cooperative or competitive nature of information exchanged within these networks, involving egg-laying, foraging, feeding, and risk-aversion behaviors, communicated through tactile, acoustic, visual, and chemosensory signals (Schneider et al. 2012; Pasquaretta et al. 2016; Bentzur et al. 2021). Understanding these social networks will be crucial for insights into disease transmission and social immunity and may also enrich our understanding of the evolution of complex social organizations.

There remain limitations to the study of sociality in D. melanogaster. Determining what constitutes a group for fruit flies is an unresolved question. Unlike insects that form nests or colonies, the group dynamics of fruit flies are less clear, especially since lab studies often restrict flies to confined spaces, not allowing for natural association behaviors. Tracking flies in the wild is challenging due to their small size and flying habits, making it difficult to ascertain if they form stable groups or associate freely (Dukas 2020). This uncertainty complicates the study of whether flies form kin-related groups and assemble for specific tasks at different life stages. Consequently, understanding inclusive fitness in fruit flies in a realistic setting is limited, hindering a comprehensive analysis of their sociality. Group formation, influenced by ecological factors, cannot be definitively categorized as cooperative or competitive without considering these factors. For example, larvae cooperation against fungi and parasitoids may not be observable in a lab setting where antibiotics inhibit fungal growth and parasitoid wasps are excluded. Thus, there is a pressing need for more naturalistic studies on fly social behavior (Wertheim 2001; Soto-Yéber et al. 2018; Dukas 2020). Future research areas include defining a group in D. melanogaster, understanding the duration and significance of group membership, examining intraspecific variation in group formation, investigating the role of social networks, studying the effects of prolonged social isolation, and dissecting the mechanisms allowing individuals to adapt to their social context. These inquiries could uncover similarities between D. melanogaster and organisms with more complex sociality.