Context. Estimating stellar masses and radii for most stars is a challenge, but it is critical to know them for many different astrophysical fields, such as exoplanet characterization or stellar structure and evolution. One of the most extended techniques for estimating these variables is the so-called empirical relations. Aims. We propose a group of frontier artificial intelligence (AI) regression models, with the aim of studying their proficiency in estimating stellar masses and radii. We select the model that provides the best accuracy with the least possible bias. Some of these AI techniques do not treat uncertainties properly, but in the current context, in which statistical analyses of massive databases in different fields are conducted, the most accurate estimate possible of stellar masses and radii can provide valuable information. We publicly release the database, the AI models, and an online tool for stellar mass and radius estimation to the community. Methods. We used a sample of 726 MS stars from the literature with accurate M, R, Teff, L, log ɡ, and [Fe/H]. We split our data sample into training and testing sets and then analyzed the different AI techniques with them. In particular, we experimentally evaluated the accuracy of the following models: linear regression, Bayesian regression, regression trees, random forest, support-vector regression (SVR), neural networks, K-nearest neighbour, and stacking. We propose a series of experiments designed to evaluate the accuracy of the estimates, and also the generalization capability of AI models. We also analyzed the impact of reducing the number of input parameters and compared our results with those from current empirical relations in the literature. Results. We have found that stacking several regression models is the most suitable technique for estimating masses and radii. In the case of the mass, neural networks also provide precise results, and for the radius, SVR and neural networks work as well. Compared with other currently used empirical relation-based models, our stacking improves the accuracy by a factor of two for both variables. In addition, bias is reduced to one order of magnitude in the case of stellar mass. Finally, we found that using our stacking and only Teff and L as input features, the accuracies obtained are slightly higher than 5%, with a bias of ≈1.5%. In the case of the mass, including [Fe/H] significantly improves the results. For the radius, including log ɡ yields better results. Finally, the proposed AI models exhibit an interesting generalization capability: they are able to perform estimations for masses and radii that were never observed during the training step.