If you hire a junior at $X/year, and two years later, the "junior" jumps ship because the two years experience qualifies them for $X * 1.5/year, then the problem isn't disloyalty on the part of the junior, it's with the company that hasn't kept up their salary.
Junior salaries are low because they're a huge gamble. If after two years you know they're a decent engineer that has learned a lot, then you need to pay them like it.
It's something I see a lot of. Your "junior" that has been there for 2 years should be getting the salary you'd be paying a new hire that has 2 years experience. If they've been there for 3 years, and you've only been giving them 3-7% raises every year, you deserve to lose that engineer for someone that will pay them 50+% more.
Junior salaries are low because they're a huge gamble. If after two years you know they're a decent engineer that has learned a lot, then you need to pay them like it.
It's something I see a lot of. Your "junior" that has been there for 2 years should be getting the salary you'd be paying a new hire that has 2 years experience. If they've been there for 3 years, and you've only been giving them 3-7% raises every year, you deserve to lose that engineer for someone that will pay them 50+% more.