This rather depends on what the NPCs are doing. They don't all advance at the same speed.
In the campaign I used to run, the party was visiting an orc tribe and the barbarian challenged the "strongest orc" in the tribe to a battle. (I should add that in my campaign, ogres, giants, etc were considered to be mutated orcs). He fought Tharg, the tribe's ogre ranger champion. Considering that Tharg was the champion of a tribe currently at war with an aggressive neighboring tribe or orcs, he should be levelling at least as quickly as the PCs. Of course, there should also be a good chance that Tharg is dead by the time the PCs next visit the tribe and his position is occupied by a different orc or ogre.
Similar fast track advancement would be enjoyed by the orc who the PCs befriended and who left the encampment at the same time as the PCs on a separate quest to discover more about his tribe's new deity. He was adventuring just like the PCs and should maintain a similar level to them. Theoretically, he also ran a significant risk of dying but his quest was supposed to tie into the plot later so he had plot immunity. [The rest of the logic is that he was supposed to be a peer of the PCs so he needed to be of similar level when he encountered them].
On the other hand, the chief constable of the town on the border of the orcs territory (the orcs had concluded a peace treaty with the human kingdom) was about 5th level and wasn't going anywhere very quickly. His advancement wouldn't be keyed to the PCs at all and would probably only occur very slowly if at all.
In the middle range of NPC advancement would be the merchant who the PCs figured for a traitor during their first adventure but could never find any proof against. He began 8 levels higher than the PCs and when the campaign finished, he was only 3 or so levels higher than them. He advanced at half to 1/3 the rate of the PCs (and the only real risk of dying he ran would be if the PCs had uncovered his schemes and exposed him). Of course, he was advancing in Aristocrat and Expert during that time rather than fighter (which is what he started as).