A system that determines an invariant magnetic-resonance (MR) signature of a biological sample is disclosed. During operation, the system determines a magnetic-resonance (MR) model of voxels in a biological sample based on differences between MR signals associated with the voxels in multiple scans and simulated MR signals. The MR signals are measured or captured by an MR scanner in the system during multiple MR scans, and based on scanning instructions, and the simulated MR signals for the biological sample are generated using the MR model and the scanning instructions. Moreover, the system iteratively modifies the scanning instructions (including a magnetic-field strength and/or a pulse sequence) in the MR scans based on the differences until a convergence criterion is achieved. Then, the system stores, in memory, an identifier of the biological sample and a magnetic-field-strength-invariant MR signature of the biological sample that is associated with the MR model.