Research on pine sawflies sheds light on the evolution of cooperation
https://phys.org/news/2018-08-sawflies-evolution-cooperation.html
Pine sawfly larvae live in groups and put up a common defence against predators. When threatened, the larvae assume a defensive posture and regurgitate a fluid that repels predators.
The study shows that the larvae pay a price for this defence. Repeated participation in the common defence increases mortality of the larvae and weakens their ability to defend against predators and parasites in further encounters with them.