countries and often find that higher demographic similarity to coworkers is positively correlated with worker retention (Elvira and Cohen, 2001; Hirsch _et al._ , 2020; Leonard and Levine, 2006; Sørensen, 2004; Zatzick _et al._ , 2003). Causal evidence is provided by Linos _et al._ (2024), who exploit random team assignments within a high-wage professional services firm in the U.S. and find very similar results to ours: A larger share of white peers only increases the turnover of black women with no effects on other race and gender groups. We add to this literature by studying the effects of racial coworker composition on workers’ retention using high-quality administrative data from Brazil. Exploiting exogenous changes in the peer group composition from unexpected worker deaths, we can isolate these changes from other confounding factors, such as firm management practices, and study the causal effects of racial coworker similarity for a large and diverse set of firms in a middle-income country.

Second, we speak to a large body of literature that studies cross-race interactions and racial segregation in various social contexts. Many papers have tested the “white flight” hypothesis to understand residential segregation, examining how neighborhood choices of whites are shaped by changes in the local exposure to minorities (Bayer _et al._ , 2024; Boustan, 2010; Card _et al._ , 2008; Shertzer and Walsh, 2019), and to understand school segregation, studying how white parents react to changes in the racial composition of schools (Baum-Snow and Lutz, 2011; Caetano and Maheshri, 2017; Cascio and Lewis, 2012; Reber, 2005). We complement this body of work by shedding new light on the retention effects of cross-race interactions at the workplace. In doing so, we also reveal important asymmetries in inter-group dynamics. While many studies focus on how the majority group reacts to increased contact with the minority group, our results indicate that the retention effects of working with same-race coworkers are not symmetric across racial groups and are more pronounced among non-white workers.<sup>4</sup> Moreover, we add an intersectional perspective to this literature by uncovering important differences in coworker composition effects across race and gender groups.

Lastly, our paper contributes to research on racial preferences and discrimination in the labor market. Much of the work focuses on hiring discrimination by employers, typically identified in correspondence studies (e.g., Bertrand and Mullainathan, 2004; Kline and Walters, 2021; Kline _et al._ , 2022) or by comparing hiring decisions of black and white managers (Aslund<sup> ̊</sup> _et al._ , 2014; Benson _et al._ , 2023; Giuliano _et al._ , 2009, 2011; Hsu Rocha and Dias, 2021). The classical Becker (1971) model of discrimination predicts that market forces will counteract taste-based

> 4Our results are consistent with evidence on homophily in friendship networks among school children and adults. The tendency of individuals to form same-type ties at higher rates than predicted by random assortment – called “inbreeding” in the homophily literature – is often found to be more pronounced among racial minority groups. This tendency works against the opportunity structure of their potential network ties which is dominated by the majority group (Laumann, 1973; Marsden, 1988; McPerson _et al._ , 2001; Shrum _et al._ , 1988).

4