Abstraction Mechanisms Predict Generalization in Deep Neural Networks