"I've cheated on my partner a few times in the beginning of our relationship. But, I've now realized what I have and I want to do right. Thing is, I'm not sure if I should tell my partner or just keep it to myself since I don't want to risk losing them. What should I do?"
If you've cheated on your partner you tell them. You always tell them. In fact, you're supposed to tell your partner everything that is important that has to do with the relationship. Open and honest communication. Come clean and give them that choice of still wanting to be with you or not. It's the right thing to do.
Now some might say that if you're no longer cheating on your partner nor plan to ever cheat on them again and your partner is unlikely to ever find out, then you should take it to your grave. Fact is, cheating threatens a relationship, but hiding it threatens it even more.
The longer you hide what happened, the more betrayed your partner will feel when they eventually find out. And the chances of them finding out are extremely high. It might not be this month or even this year, but it will happen someday.
Not only that, but when a person gets away with cheating, the more time passes, the higher the chance the partner will get the urge to just cheat again. They begin to believe that, "Well, I never told them and it's been __ years, I could probably cheat again and they won't find out this time either."
A healthy relationship can never be built on a lie.
I recommend reading this: