It more or less depends on the part of the game for me. Sometimes, after doing side quests or going down a side route and battling all its trainers, my Pokemon end up being at a matched or higher level than certain Gym leaders. By the time I reach the Elite 4, though, I'm always several levels below them, even after battling every trainer I can find. That's how I like it, though.