We propose a model that reflects two important processes in R&D activities of firms, the formation of R&D alliances and the exchange of knowledge as a result of these collaborations. In a data-driven approach, we analyze two large-scale data sets, extracting unique information about 7500 R&D alliances and 5200 patent portfolios of firms. These data are used to calibrate the model parameters for network formation and knowledge exchange. We obtain probabilities for incumbent and newcomer firms to link to other incumbents or newcomers able to reproduce the topology of the empirical R&D network. The position of firms in a knowledge space is obtained from their patents using two different classification schemes, IPC in eight dimensions and ISI-OST-INPI in 35 dimensions. Our dynamics of knowledge exchange assumes that collaborating firms approach each other in knowledge space at a rate μ for an alliance duration τ. Both parameters are obtained in two different ways, by comparing knowledge distances from simulations and empirics and by analyzing the collaboration efficiency. This is a new measure that takes in account the effort of firms to maintain concurrent alliances, and is evaluated via extensive computer simulations. We find that R&D alliances have a duration of around two years and that the subsequent knowledge exchange occurs at a very low rate. Hence, a firm’s position in the knowledge space is rather a determinant than a consequence of its R&D alliances. From our data-driven approach we also find model configurations that can be both realistic and optimized with respect to the collaboration efficiency. Effective policies, as suggested by our model, would incentivize shorter R&D alliances and higher knowledge exchange rates.