It has been proven repeatedly that you can not "fix" a pedophile. These creatures are a complete write off. So that side of the system is a waste of money, and effort. The deterrent side does still hold some hope however. In the case of an egregiously violent attack on a child, under twelve, as painful a death as possible should await them. My choice would be burning them to death, in the manner of the Romans. I don't think any compulsion would allow you to ignore a fate like that.