Diamond proved a numerical criterion for modules over local rings to be free modules over complete intersection rings. We formulate a refinement of these results using the notion of Wiles defect. A key step in the proof is a formula that expresses the Wiles defect of a module in terms of the Wiles defect of the underlying ring.