There is substantial variation in either absolute or relative brain size between vertebrates. Comparing vertebrate species is the most commonly used method when exploring the link between brain size variation and ecological conditions. Nevertheless, there is an ongoing debate about whether the main selective factors on the evolution of brain complexity are driven by social or environmental challenges. Furthermore, the measures of brain complexity that correlate best with cognitive performance remain contested. It has thus been proposed that a “bottom-up” approach, by studying individual variation, may yield important complementary insights on the links between ecological conditions, cognitive performance and brain complexity. This PhD thesis aimed to use the bottom-up approach in a study on the cleaner fish Labroides dimidiatus. Cleaner fish engage in mutualistic cleaning interactions, by removing ectoparasites from a variety of “client” coral reef fishes. Previous research has documented a strong behavioural divergence within the same population in this species. Cleaners differed in their strategic sophistication in laboratory experiments that feature key aspects of cleaner-client interactions: 1) reputation management, wherein the adjustment of service quality in the presence of bystanders; and 2) cleaning service priority to clients with partner choice option. From this, the main question was which ecological factors can explain this behavioural variation. In Chapter I, the succession of environmental perturbations at the study site in Lizard Island, Great Barrier Reef, Australia, provided natural conditions for my experiment as the perturbations significantly altered ecological variables on the reef. The study consisted of collecting fish censuses and behavioural recordings at various reef sites around the island, as well as testing cleaners from these sites in the two laboratory-based cognitive tasks. I found that formerly socially complex sites with high fish densities, and cleaners with high strategic sophistication, recorded very low fish densities after the perturbations with cleaners showing low strategic sophistication in the tasks. This study suggests that individuals adjusted their strategic sophistication to the new ecological conditions from before to after the perturbations. In Chapter II, an analysis of fish censuses, behavioural recordings and cleaners’ performance in laboratory tasks over several years revealed that the reduction in cleaner density (i.e., a reduced supply in the cleaning biological market), was the primary driver of low strategic sophistication. Also, cleaner density was strongly correlated with large client density, suggesting that the results cannot be well explained by changes in the supply-to-demand ratio. Based on the results of Chapters I and II, I employed cleaner density as a proxy of both the intra- and interspecific social complexity in Chapter III and IV. The aim of Chapters III and IV were thus to investigate potential correlations between social complexity, strategic sophistication and brain complexity. In Chapter III, the magnetic resonance imagery (MRI) method was used to estimate with high precision the volumes of the five main brain major areas (i.e., telencephalon, diencephalon, mesencephalon, cerebellum, and brain stem). I found that cleaner density correlated positively with relative forebrain size (i.e., telencephalon and diencephalon together form the forebrain). Indeed, the forebrain harbours the “social decision-making network”; a network of brain nuclei involved in decision-making within a social context. These findings were mirrored in the outcomes of Chapter IV where I found a positive correlation between social complexity and the number of brain cells and neurons. Interestingly, strategic sophistication did not predict brain complexity. Instead, cleaners demonstrated social competence by displaying strategies that were optimal at their reef site of capture (i.e., low sophistication at low cleaner density, and high sophistication at high cleaner density). These cleaners also had relatively larger forebrains with more cells/neurons. The effect of size was strong, where there was a ~ 40 % difference in relative forebrain neuron count between low and high social complexity. In conclusion, this thesis provides unique insights on the links between ecology, cognition and brain features within a species. The results support the idea that the bottom-up approach may provide important insights into the selective pressures on brain complexity. Importantly, most of the documented variation is likely due to ontogenetic effects, as the egg and larval stages are pelagic in the cleaner fish species. This implies that laboratory experiments that manipulate key ecological factors during development can be used to test for potential effects on brain structure. According to the results, social complexity is a key factor driving forebrain size and cell/neuron number adjustments. Finally, the social competence analysis suggests that, in the case of cleaner fish, part of the selection on increased forebrain complexity is due to intraspecific social complexity.