Sex cells develop from masses of tissue in the metameres and leave by way of tubules or by rupture of the body wall. In most cases fertilization of the eggs by sperm occurs externally in seawater and results in the formation of free-swimming larvae. Variations include internal fertilization, laying of egg masses that are attached to objects with mucus, and brooding of developing eggs in the worm's body. In some of these species the portion of the body containing the sex cells breaks free and engages in swarming and spawning, leaving the asexual portion behind to regenerate its lost parts. Swarming generally occurs at night and is correlated with particular phases of the moon.
Some species perform a kind of nuptial dance, swimming in circles as they spawn.
In some species the worms liberate a luminous secretion, which produces circles of light on the ocean surface as they dance. The most famous swarming polychaete is the tropical palolo worm, a name sometimes applied to all swarming polychaetes. Archiannelida and Myzostomaria Two groups of polychaetes that are sometimes regarded as separate classes are the Archiannelida and the Myzostomaria. The former group includes a variety of minute marine worms living in surface mud, in tidepools near the high-tide line, and in the interstitial spaces of mud and sand in some subtidal areas. All archiannelids are scavengers.