The catch-up effect and the Matthew effect offer opposing characterizations of globalization: the former predicts an eventual convergence as the poor can grow faster than the rich due to free exchanges of complementary resources, while the latter, a deepening inequality between the rich and the poor. To understand these effects on the globalization of research, we conduct an in-depth study based on scholarly and patent publications covering STEM research from 218 countries/regions over the past four decades, covering more than 55 million scholarly articles and 1.7 billion citations. Unique to this investigation is the simultaneous examination of both the research output and its impact in the same data set, using a novel machine learning based measure, called saliency, to mitigate the intrinsic biases in quantifying the research impact. The results show that the two effects are in fact co-occurring: there are clear indications of convergence among the high income and upper middle income countries across the STEM fields, but a widening gap is developing that segregates the lower middle and low income regions from the higher income regions. Furthermore, the rate of convergence varies notably among the STEM sub-fields, with the highly strategic area of Artificial Intelligence (AI) sandwiched between fields such as Medicine and Materials Science that occupy the opposite ends of the spectrum. The data support the argument that a leading explanation of the Matthew effect, namely, the preferential attachment theory, can actually foster the catch-up effect when organizations from lower income countries forge substantial research collaborations with those already dominant. The data resoundingly show such collaborations benefit all parties involved, and a case of role reversal can be seen in the Materials Science field where the most advanced signs of convergence are observed.