Left: The evolutionary pressure to maintain functional biomolecules leaves a record of amino acid or nucleotide co-conservation in multiple alignments of a sequence family. Middle: A pairwise graphical model learned from the natural sequence variation reveals family-specific constraints between pairs of positions (Jij) as well as at single sites (hi). Each hi is a vector unique to each position in the family that describes the relative favorability of different amino acids or nucleotides at that position, while each Jij is a matrix unique to each pair of positions describing an interaction pattern for the relative favorability of different combinations of amino acids/nucleotides at those positions. The values of these parameters are inferred by maximizing the probability of observing the natural sequences, with additional penalties for model complexity. Right: The inferred probability model can be applied to compute the relative effect of both single and higher-order substitutions. The calculation evaluates how compatible substitutions in the context of the wild-type sequence are with the functional constraints on the family by summing over the changes of couplings to all other sites (Jij), as well as the changes of single-site constraint terms in the changed positions (hi).