(A) Schematic shows affinity maturation in germinal centers(right), where B-cell receptors acquire mutations and undergo selection, resulting in an increase in their affinity to an antigen (from light to dark receptors), indicated by the sharpening of receptors’ affinity profiles (on left). (B) Upon infection, the immune system can initiate a novel response (top) or a memory response (bottom). A novel B-cell response could involve affinity maturation to generate memory or high-affinity plasma cells (pink) that can secrete antibodies to battle the pathogen. A novel response can take 1–2 weeks, during which pathogen can replicate within a host and a patient can show symptoms from the disease (top, left). During this time, the proliferation of pathogens within a host incurs a cost associated with a naive response , which is a monotonic function of the deliberation time τ (top, right). If the host carries memory from a previous infection or vaccination (bottom), the immune system can robustly and rapidly activate a memory response to battle the infection. The probability to mount such memory response depends non-linearly on the relative utilities of memory versus naïve responses against a given infection (bottom, right). (C) Affinity profile of a memory receptor rm is shown in orange as a function of the distance in the antigenic shape space, between the receptor’s cognate antigen (orange) and an evolved novel target (red). The affinity of a receptor decays with increasing distance between targets and its cognate antigen. The antigenic range over which a receptor is reactive inversely depends on its specificity α. The shape of the binding profile is tuned by the factor θ, here shown for . The expected binding profile and the expected utility for an immune response are weighted averages of these quantities over memory and naïve responses. The Kullback-Leibler distance between the expected profile and the profile centered around the infecting antigen , in units of the deliberation factor β, defines the sub-optimality of a response, that is,, dissipation (Equation 1). The net utility measures the goodness of a decision to mount a memory vs. naive response against an infection (Equation 2). (D) Antigenic evolution of the H3N2 influenza virus is shown over 40 years along its first (most variable) antigenic dimension (data from Bedford et al., 2014). The decision of an immune system to utilize memory or to mount a novel response (B,C) is determined by the specificity α of receptors and the deliberation factor β. We characterize the optimal immune strategies () by maximizing the total net utility of immune responses against pathogens with different antigenic divergences, experienced over the lifetime of an organisms (Equation 3).