They go through a dramatic metamorphosis - but still remember the knowledge gained
I bet when you learned about metamorphosing a caterpillar into the butterfly stage, you were surprised. After all the animal basically gets a new body. And surprisingly, scientists at Georgetown University found that animals remember things they learned in their early stages of development.
To test the hypothesis, the researchers trained caterpillars to avoid certain types of smell (associating odors with shocks). They later found that, in the adult stage, butterflies still avoided the smells that were associated with shock - even though knowledge was not reinforced in adulthood.
Although this indicates that memories remain, researchers still do not know what structure is responsible for storing this information.
But how important is it to know that butterflies remember larval stage events? Basically because it can influence your choice of habitat - and with insects being important pollinators that ensure plant reproduction, understanding their choices is paramount.
(//revistagalileu.globo.com/Ciencia/noticia/2015/08/borboletas- can- remember- that- learned-when-were-lagartas.html)