Abstract Quantitative comparisons of a bidirectional associative memory (BAM), a modified BAM and an optimal associative memory (OAM) neural network are presented for background prediction of infrared (IR) spectra. These memories were evaluated using 2 cm −1 resolution IR spectra. The efficacies of these methods were quantitatively evaluated using root mean square prediction errors of 100% transmittance lines. In all cases, the OAM performed superiorly to the BAMs. The OAM has no retrieval error, because it stores patterns that are orthogonal. Binary encoding of spectra is advocated for BAMs, because the stored patterns are approximately orthogonal. Once the number of grids is large enough to differentiate stored spectra, the dependence on the number of resolution elements disappears. The OAM is a technique that can be applied to any type of data as long as two conditions are satisfied: the background spectra and the sample spectra must have points of intersection and the signal variations in the sample need to be different from the background variations.