HLA-DM (DM) mediates exchange of peptides bound to MHC class II (MHCII) during the epitope selection process. Although DM has been shown to have two activities, peptide release and MHC class II refolding, a clear characterization of the mechanism by which DM facilitates peptide exchange has remained elusive.We have previously demonstrated that peptide binding to and dissociation from MHCII in the absence of DM are cooperative processes, likely related to conformational changes in the peptide-MHCII complex. Here we show that DM promotes peptide release by a non-cooperative process, whereas it enhances cooperative folding of the exchange peptide. Through electron paramagnetic resonance (EPR) and fluorescence polarization (FP) we show that DM releases prebound peptide very poorly in the absence of a candidate peptide for the exchange process. The affinity and concentration of the candidate peptide are also important for the release of the prebound peptide. Increased fluorescence energy transfer between the prebound and exchange peptides in the presence of DM is evidence for a tetramolecular complex which resolves in favor of the peptide that has superior folding properties.This study shows that both the peptide releasing activity on loaded MHCII and the facilitating of MHCII binding by a candidate exchange peptide are integral to DM mediated epitope selection. The exchange process is initiated only in the presence of candidate peptides, avoiding possible release of a prebound peptide and loss of a potential epitope. In a tetramolecular transitional complex, the candidate peptides are checked for their ability to replace the pre-bound peptide with a geometry that allows the rebinding of the original peptide. Thus, DM promotes a "compare-exchange" sorting algorithm on an available peptide pool. Such a "third party"-mediated mechanism may be generally applicable for diverse ligand recognition in other biological systems.