I can only attest to my experience in prison. I never heard of a sex offender being killed in one of the several state prisons I was at.
In the two federal prisons, there was one guy murdered, but it was because he was stupid. When he arrived, he fell in with the Aryan Brotherhood gang, a white supremacist group. Pretended to be a drug dealer. When the law library stumbled upon his case and discovered he had run a child prostitution house inside Mexico, the AB's had to do him in to save face.
The only people in prison who get hurt are the ones who deserve it. You might say, well, that guy is in for that heinous crime, but as long as the guy is respectful and doesn't overstep social boundaries he'll get along fine in federal prison.