For example, when fighting neutral creatures of level 1-2, depending on their number, the probability of learning a random spell of level 1-2 changes linearly or according to some formula. When fighting neutral creatures of level 7, there is some probability of learning a spell of level 4-5 at the end of the battle.
I think that if the probability is chosen correctly, the game will become more interesting and diverse. That's it.