The striking patterns of collective animal behavior, including ant trails, bird flocks, and fish schools, can result from local interactions among animals without centralized control. Several of these rules of interaction have been proposed, but it has proven difficult to discriminate which ones are implemented in nature. As a method to better discriminate among interaction rules, we propose to follow the slow birth of a rule of interaction during animal development. Specifically, we followed the development of zebrafish, Danio rerio, and found that larvae turn toward each other from 7 days postfertilization and increase the intensity of interactions until 3 weeks. This developmental dataset allows testing the parameter-free predictions of a simple rule in which animals attract each other part of the time, with attraction defined as turning toward another animal chosen at random. This rule makes each individual likely move to a high density of conspecifics, and moving groups naturally emerge. Development of attraction strength corresponds to an increase in the time spent in attraction behavior. Adults were found to follow the same attraction rule, suggesting a potential significance for adults of other species.collective behavior | interaction rule | zebrafish | development | shoaling C ollective animal behavior is studied with increasing detail in natural habitats (1-6) and laboratory conditions (7-14). Local interactions among animals can, in many cases, explain these patterns of collective behavior, and a variety of interaction rules have been proposed (7,8,11,(14)(15)(16)(17)(18)(19)(20)(21)(22)(23)(24)(25)(26)(27).One of the technical problems in discriminating among possible interaction rules is the difficulty of obtaining high-quality experimental data (25). We reasoned that the ontogeny of attraction behavior offers a unique opportunity to obtain a large highquality dataset. This dataset should constrain the space of possible models to those that can explain interactions every day during development.We turned to zebrafish, Danio rerio, a species in which larvae seem not to attract each other after hatching but that develop shoaling and schooling behavior during the first month of development (12,14,(28)(29)(30)(31)(32)(33). Our choice was based on our previous work in the adult suggesting a simplicity of the rules compared with other species (14).In this work, we follow the formation of attraction behavior during the ontogeny of collective behavior in zebrafish. We used our newly developed tracking system of animals in groups, idTracker (34), in a total of 524 videos for the study of development and 25 videos for adults. We found that zebrafish are very weakly attracted to each other by 7 days postfertilization (dpf), and the attraction gets stronger each day during development. By 9 dpf, larvae are likely found close to each other, and, by 15 dpf, it is common to see animals moving in groups. Analysis and modeling of the developmental dataset point to attraction as turning toward a randomly chosen consp...