The tadpoles get a tip that the pools are shrinking when they start bumping into each other and fairy shrimp, insect-like animals that also thrive in puddles. If a tadpole eats one of the shrimp, it can spark a transformation into a full-fledged cannibal. Even the cannibals can be somewhat careful about their diets, however, as researcher David Pfennig of North Carolina State University has shown. In some species, the cannibals generally avoid eating their brothers and sisters, preferring to eat unrelated tadpoles instead. Exactly how they tell the difference between friend and foe isn't known.
Tadpoles can also undergo other types of changes when conditions change.
Some, for instance, change color and start producing a distasteful chemical when one of their friends is munched by a predator. The dying tadpole releases chemicals that warn other tadpoles that a predator is nearby. Within hours or days, nearby tadpoles turn bright colors, which, like a living billboard, warn predators that they don't taste very good. It's a change that helps ensure their survival.