We develop and analyze a framework for consistent QM/MM (quantum/classic) hybrid models of crystalline defects, which admits general atomistic interactions including traditional off-the-shell interatomic potentials as well as state of art machine-learned interatomic potentials. We (i) establish an a priori error estimate for the QM/MM approximations in terms of matching conditions between the MM and QM models, and (ii) demonstrate how to use these matching conditions to construct practical machine learned MM potentials specifically for QM/MM simulations.