Have you ever looked, I mean really looked, at the NPCs in the Pathfinder GameMastery Guide? Specifically, at the NPCs listed under the “Villagers” heading in Chapter 8: NPC Gallery? Yeah, it’s fun to laugh at the village idiot entry, but what about the others?
More specifically, take a look at the entries for the farmer and the mayor. It doesn’t bother a lot of people, but it’s always rubbed me the wrong way that the farmer has not one, but two class levels; this is to say nothing of the mayor having ten. True, they’re all NPC class levels, but the salient question remains: how did these guys ever get the experience points necessary to level up?
It’s unlikely (though possible, albeit far-fetched) that these were the results of story XP awards. I find it hard to imagine exactly what the story there was, however. Perhaps the mayor got an XP award for winning the local mayoral election? But what would the farmer’s XP awards look like? “You survived another unbelievably harsh winter! Gain 100 XP!”
It’s only slightly more plausible that these characters gained XP the same way most adventurers do: by killing things. Partially this implausibility is due to how ridiculously weak both characters are (the mayor is a CR 8 character, but she wasn’t always that high-level). It’s hard to imagine a level 1 commoner wracking up enough kills to advance in level. True, he may fend off the occasional rat (100 XP) or two, and perhaps the rare goblin (135 XP), but those are still a long way from the 2,000 XP necessary to hit 2nd level on the medium XP track.
What I’m trying to get at here is that these NPCs likely gained XP in a way not covered by the Core Rules: training.
Training Troubles
Training as an XP activity is something that’s usually left out of most Pathfinder – and other d20 – games. The usual reason for this is that most GMs don’t see a need to include a nod to verisimilitude in regards to a meta-game function like earning experience points; particularly when doing so often seems to leave the system open to abuse. In other words, it offers too little gain for the headaches that come with it.

Because it only deals Charisma damage.
These headaches are usually found in a player saying that they want to have their character spend some drastic amount of down-time training, then hand-wave away that time having happened, and re-introduce their character now that they’ve leveled up (“okay, so I spend the fifteen years at the monastery, and when I come out I’ve gained eight levels of monk! Let’s go adventuring!”)
To be fair, it’s easy to shut this particular problem down at the beginning of a campaign (e.g. the GM says “No, you’re not starting with a 45-year-old graduate of the war college. You’re just like everybody else, a teenage knucklehead just starting out!”). The problem often comes after the campaign has started, when the GM has already laid out the training rules, and it’s suddenly harder to hand-wave things away (“We saved the village right? Why can’t I buy a house there and teach magic at the local mage’s college for a while? Let someone else rescue the duke’s daughter.”)
All of these issues, however, are actually symptoms of a single problem: the GM is making training too good.
Rate of Return
The solution here is simple – training grants XP at such a low rate that it shouldn’t ever be worth it to your PCs. The rate of return should be so abysmally small that it’s never worthwhile to contemplate if there’s any other avenue of XP acquisition available (and, for your PCs, there always is).
So what rate is so horrifically low that it’d scare off your players? There’s all kinds of rates you can set, but the one I usually stick to is that one day of training grants 1 XP. Given that – plus the fact that no one can realistically train every single day – most characters would need around six years just to make it from 1st to 2nd level (using the medium advancement track). It’d take roughly another eight years to make it from 2nd to 3rd, and about twelve years to go from 3rd to 4th. At this point, your character has spent a quarter-century training, and hasn’t even made it to casting third-level spells yet.

Can you spot young Elminster in this photo?
One interesting side-effect of this system is that it gives demi-humans (that is, elves, dwarves, gnomes, halflings, etc.) a plausible reason for being generally higher-level than humans…though not much. They’ve had more time to train; the diminishing rate of returns, however (as it takes more and more XP to gain a level) ensures that this will keep most demi-humans from having super-high levels from training alone (getting to 6th level using this system would take almost one hundred-fifty years of training!).
Of course, this brings up a salient point – if it takes lifetimes just to earn a couple of levels, how do guys like the aforementioned mayor get to be 10th level? Ah, but that’s the nice part about NPCs not needing to earn their levels through actual play – you can say that she actually did earn them fighting monsters or winning story awards. Perhaps the mayor personally lead the charge against an invading orc horde, despite having no military training (and killed several, earning XP). Or perhaps she uncovered political corruption in town (for a story XP award). At 10th level, the mayor should have some sort of noteworthy background.
Ironically, these low-XP training rules can be of help to PCs as well. Perhaps if the PCs find themselves just 200 XP short of the next level, they decide to take six or seven months off from adventuring to train and earn those last few experience points. That’s fine; remember, our goal is to stop the training rules from being abused, not make them absolutely useless. This is also a nice way to prevent your adventurers from going to 1st to 20th level in less than a year (something that seems to happen a lot).
Work Hard, Game Hard
Most likely, at some point while reading the above, you wondered to yourself, “why use training rules at all? If we’re keeping the PCs away from these, I can just make my NPCs whatever level I want.”
Leaving aside how, as mentioned above, these rules aren’t meant to repel the PCs but simply discourage abuse, the last phrase is true; there’s no reason the GM can’t set their NPCs with whatever level they want. The training-for-XP rules aren’t meant to shackle the GM; they’re meant to be a good shorthand for measuring a character’s age-to-expertise ratio, where their age is how long they’ve been training and their expertise is how much XP they’ve gained for it.
This guideline lets you quickly determine that a character that’s been a farmer for thirty years has about 10,000 days of farming, which means he has about 10,000 XP, which makes him about 4th level. Once you’ve got that, you can easily adjust the totals by providing other reasons for how he got his experience. Suppose you want your farmer to be a younger fellow, but still 4th level. Then he must have gotten some of his experience another way – did he go adventuring for a bit and then retire for some reason? Is he a local celebrity for having performed some incredible deed? Just like that, the training rules have helped stimulate our back-story for an otherwise-ordinary character.
Training, and providing a means by which ordinary people improve without killing monsters or completing quests, helps to flesh out the world just a little bit more. In doing so, it makes the game world a little more vibrant, and thus more fun, for everyone involved.