In slow, cold composting conditions, weed seeds and tough plant parts will survive.
To avoid releasing these in your garden,
it is best to pick weeds before they go to seed, and to avoid adding roots or stems from docks, briars, bindweed, ivy or other noxious, perennial weeds.
In a hot composting pile, seeds and chopped-up vegetation will be killed by
the high temperatures in the middle of the pile, but maintenance of high temperatures requires some management and manual turning of the composting material.
If you have lots of weeds, it’s best to create a dedicated pile in a sunny spot and cover with black plastic. This should dry and heat the weeds enough to kill them.