We formalized the nuclear mass problem in the inverse problem framework. This approach allows us to infer the underlying model parameters from experimental observation, rather than to predict the observations from the model parameters. The inverse problem was formulated for the numerically generalized semi-empirical mass formula of Bethe and von Weizsäcker. It was solved in a step-by-step way based on the AME2012 nuclear database. The established parametrization describes the measured nuclear masses of 2564 isotopes with a maximum deviation less than 2.6[Formula: see text]MeV, starting from the number of protons and number of neutrons equal to 1. The explicit form of unknown functions in the generalized mass formula was discovered in a step-by-step way using the modified least [Formula: see text] procedure, that realized in the algorithms which were developed by Lubomir Aleksandrov to solve the nonlinear systems of equations via the Gauss–Newton method, lets us to choose the better one between two functions with same [Formula: see text]. In the obtained generalized model, the corrections to the binding energy depend on nine proton (2, 8, 14, 20, 28, 50, 82, 108, 124) and ten neutron (2, 8, 14, 20, 28, 50, 82, 124, 152, 202) magic numbers as well on the asymptotic boundaries of their influence. The obtained results were compared with the predictions of other models.