We already know jumping gives on average a 15% salary increase every two years, so you just have to beat or match that.
Now people might still leave for more interesting projects, but you get one of the larger motivational factors out of the way.
People often leave because negotiating a salary upgrade is way harder than navigating an interview.
So, unless your hidden motive is to have cheap labor just write down in the contract that every two year the salary will increase 15% minimum, unrelated to objective bonus and all that bullshit.
The you have it. The secret for training and retaining talent in a competitive market.