system
Given the following post, respond as if you're commenting on Reddit:
human
ELI5: How does the immune system store information about infections that it has defeated? How is it able to "remember" diseases to produce antibodies?
gpt
Imagine your immune cells all start with a set of different patterns. 50 cartoon heads, 10 bodies, and 6 legs. These are written in your DNA.

When the immune cell matures, it randomly cuts out and chooses a head, body and leg from it's DNA, and throws away the rest of the DNA. That immune cell then goes around looking for the head/body/leg combo it's created. If it finds it while it's still at immune cell university, then it gets told that's "self" and it shouldn't respond. That immune cell then shuts down. If it doesn't get told it's "self", then the immune cell graduates university and goes to a lymph node, looking for the head/body/leg combo.

One day, a dendritic cell comes running into the lymph node and shouts he's seen a scary looking chap around! He's got a photo of him, and it looks a bit like the head/body/leg the immune cell has. This is the trigger the immune cell has been waiting for, and it starts churning out it's antibody from it's own DNA combination.

The cell also reproduces, to create more specific cells for that target. Each generation will modify their antibody DNA slightly (draw with marker pen on their head/body/legs combo), and the ones which are better at binding the target will reproduce more, evolving rapidly into a highly powerful antibody. This is written in these immune cells' (BCells) DNA. After the disease has gone, some of these cells go dormant and live in the bone marrow/lymph nodes as memory BCells, waiting to be activated by that disease again.