This post is something you can skip if you're not terribly interested in some technical minutia of Ice and Fire's unit experience system, especially since this is a fairly incomplete understanding.
Some ground rule points: a given unit cannot gain more than...
30 to Attack and Defense
20% to Damage
40% to Health
15 to base crit chance
15 to their overall resistance
1 to Speed and Initiative
3 Runes in total
+50% to summoning
+50% to healing
regardless of what its bonuses might theoretically lead to. Additionally, going off a combination of the internal file designations and personal experience, stats other than Attack and Defense cannot be acquired until certain minimum levels, specifically...
Damage is unlocked at Level 6
Health is unlocked at Level 5
Crit chance is unlocked at Level 3
Resistance is unlocked at Level 4
Initiative is unlocked at Level 6
Speed is unlocked at Level 7
Runes are unlocked at Level 4
Summoning increase is unlocked at Level 3
Healing increase is unlocked at Level 5
So basically a unit's first level will always be just some amount of Attack and Defense, and the most consistent/dramatic boosts take a while to get to. Fairly sensible.
Also note that when leveling provides increases to resistance, this is always to every damage type except Astral by an equal amount, regardless of the unit's own resistances.
Secondly, the game's experience mechanics are based around classes. Every unit belong to at least one class, and each class has its own set of bonuses, with units that belong to multiple classes pulling from all the classes they belong to to determine their bonuses.
Those classes are the following list, with the names based on the names in the .txt file.
... though note I may have made errors in attributing which units are in which class. Some of the internal designations are difficult to keep straight, such as how Mystics and Contemplators are internally 'mystique' and 'mystik', respectively. I think I've got it all right, but if your experience doesn't line up somewhere, it may be I messed up a unit's placement. (I certainly had an error when this post first went up... and spent years having my Mystic/Contemplator explanation backwards. Fortunately, they fully share categories, so that particular mixup couldn't have led to meaningful mis-categorization)
Base Class
Includes: Everything.
Parameter 2: +1 Attack
Parameter 3: +1 Defense
Parameter 4: +1% Crit chance
Parameter 5: +1 Attack
Parameter 6: +1 Defense
Parameter 7: +1% Crit chance
Parameter 8: +1 Attack
Parameter 9: +1 Defense
Parameter 10: +1% Crit chance
Note that since Attack and Defense directly cancel each other out, the impact of the Base class is primarily things like 'units you're first getting up to speed in the late game are going to be behind'. Two units of similar level with no other experience classes being involved will frequently end up with their Attack/Defense levels canceling out, or very close.
Light Shooter
Includes: Thorn Hunter, Ice Thorn, Gobot, Worm, Skeleton Archer, Goblin, Bowman, Priest, Slinger
Parameter 2: +1 Attack
Parameter 3: +1 Initiative
Parameter 4: +1% Crit chance
Parameter 5: +1 Rune
Parameter 6: +1 Attack
Parameter 7: +1% Crit chance
Parameter 8: +1 Defense
The big one here is that Initiative bonus, though the Rune is nice if a bit random in what you'll actually get.
Also note that there's seven parameters, to the 9 the Base class has. Only the Base class has 9 parameters, with the majority of other classes having 7. I'd originally thought this correlated to how the player's maximum level on units is 10 (9 level-ups, since you start at level 1) while the AI's max is level 8 (7 level-ups), but at this point I'm reasonably confident that's basically a coincidence, and am not sure of the actual implication of it.
Shooter
Includes: Beholder, Ice Spider, Elf, Faun, Repair Droid, Goblin Shaman, Catapult, Inquisitor, Gorguana, Elder.
Parameter 2: +1 Attack
Parameter 3: +1 Initiative
Parameter 4: +1% Crit chance
Parameter 5: +1 Attack
Parameter 6: +1% Resistance
Parameter 7: +1% Crit chance
Parameter 8: +1 Rune
As with Light Shooter, Initiative and the Rune are the main things that are a big deal. That said, Ice Spiders and Repair Droids both have a base resistance large enough for the resistance bonus to be legitimately kind of noticeable in real play, especially if you're making sure to get Guardian.
Heavy Shooter
Includes: Hunter, Avenger, Ent, Scout, Alchemist, Cannoneer, Evil Beholder, Gorgon, Royal Thorn, Brontor, Axe Thrower.
Parameter 2: +1% Crit chance
Parameter 3: +1 Attack
Parameter 4: +1% Crit chance
Parameter 5: +1 Attack
Parameter 6: +1 Rune
Parameter 7: +1 Initiative
Parameter 8: +5% Health
Heavy Shooter is notable primarily for the Health gains, when compared to the other Shooter classes. Most of the list appreciates it just in terms of being units that perform okay in melee. Even Hunters have this true to an extent. (Though not Avengers or Scouts)
Light Trooper
Includes: Skeleton, Undead Spider, Pirate Ghost, Zombie, Ghost, Pirate, Spider, Venomous Spider, Fire Spider, Snake, Swamp Snake, Devilfish, Lake Dragonfly, Fire Dragonfly, Thorn Warrior, Hyena, Wolf, Robber, Marauder, Peasant, Swordsman, Lake Fairy, Forest Fairy, Sun Fairy, Snowflake Fairy, Ice Nymph, Gobot, Miner, Imp, Skald.
Parameter 2: +1 Attack
Parameter 3: +1% Resistance
Parameter 4: +1 Defense
Parameter 5: +1 Attack
Parameter 6: +1 Rune
Parameter 7: +1 Speed
Parameter 8: +1 Defense
Notice that while this is primarily fairly basic/generic melee units, it actually includes Gobots, which showed up under Light Shooter as well.
Trooper
Includes: White Werewolf, Werewolf, Unicorn, Black Unicorn, Orc, Furious Goblin, Bear, Ancient Bear, Sea Dog, Royal Snake, Griffin, Decaying Zombie, Vampire, Cursed Ghost, (regular) Gorgul, Vengeful Gorgul, Scoffer Imp, Cerberus, Guardsman, Dwarf, Viking, Berserker.
Parameter 2: +1% Resistance
Parameter 3: +1 Attack
Parameter 4: +1% Crit chance
Parameter 5: +1 Defense
Parameter 6: +1 Speed
Parameter 7: +1 Defense
Parameter 8: +1 Rune
Notice that, along with Light Trooper, a lot of melee units in Ice and Fire can eventually pick up additional Speed. This has a surprisingly pronounced impact on the mid-late game, and makes enemy melee notably more threatening. It also gives you more incentive to consider using melee yourself, at least once you're done with Grand Strategian; between your melee probably picking up Speed and enemy melee probably picking up Speed, it's much more likely your melee will be able to strike on the very first turn. (Especially once you have Tactics, if you're placing your melee aggressively)
Elite Trooper
Includes: Jarl, Warrior Maiden, Polar Bear, Royal Griffin, Witch Hunter, Assassin, Knight, Paladin, Horseman, Black Knight, Ancient Vampire, Ram-Thor, Winged Shadow, Highterant, Brontor, Advisor, Demon, Executioner, Demoness, Orc Veteran, Ent, Guard Droid, Foreman, Frost Unicorn.
Parameter 2: +5% Health
Parameter 3: +1 Speed
Parameter 4: +1 Attack
Parameter 5: +1% Resistance
Parameter 6: +1 Defense
Parameter 7: +1 Rune
Parameter 8: +1 Initiative
Notice that Brontors were also under Heavy Shooter. Sadly, since Initiative can't stack above a bonus of 1, this doesn't do much to make up for their lacking Initiative... though at least they can (probably) actually walk places if you level them up enough without having to rely on Ram or skip out on attacking in a given turn.
Healer
Includes: Priest, Inquisitor, Paladin, Engineer, Repair Droid, Faun, Orc Tracker, Sorcerer, Soothsayer.
Parameter 1: +10% healing power
Parameter 2: +10% healing power
Parameter 3: +10% healing power
Parameter 4: +10% healing power
Parameter 5: +1 Defense
Parameter 6: +1% Resistance
Parameter 7: +1 Rune
Naturally exclusive to units that heal, causing them to eventually provide up to 40% more healing than they usually provide. This is particularly impressive for the portion that can actually resurrect units, of course, which happens to be everything in the list except poor, poor Priests.
Low Supporter
Includes: Thorn Warrior, Thorn Hunter, Ice Thorn, Dryads, Ice Nymphs.
Parameter 2: +10% summoning amount
Parameter 3: +10% summoning amount
Parameter 4: +10% summoning amount
Parameter 5: +10% summoning amount
Parameter 6: +1 Defense
Parameter 7: +1% Resistance
Parameter 8: +1 Rune
A class just for Thorn summoners, which does not include Royal Thorns... which is because they're in the next class instead.
I'm not entirely sure why there's a Thorn-summoning experience class. It's a little weird.
Supporter
Includes: Royal Thorn, Royal Griffin, Ice Dragon, Gorgon, Demonologist, Demon, Evil Eye, Necromancer, Orc Tracker, Shaman, Engineer, Chosha, Druid.
Parameter 2: +10% summoning amount
Parameter 3: +10% summoning amount
Parameter 4: +10% summoning amount
Parameter 5: +5% Health
Parameter 6: +1 Defense
Parameter 7: +1% Resistance
Parameter 8: +1 Rune
Less focus on summoning than Low Supporter, but in exchange you can get a boost to Health. The Demon particularly appreciates this, and the Chosha is the only unit that would probably rather be in Low Supporter.
In the case of Shaman, the summoning boost increases the amount of Health their Totems of Life and Death spawn with, which is actually kind of whatever.
Battle Mage
Includes: Pyromage, Archmage, Rune Mage, Witch Hunter, Shaman, Blood Shaman, Goblin Shaman, Elder, Gorguana Ghost, Gorguana, Mystic, Contemplator, Demonologist, Evil Eye, Necromancer.
Parameter 2: +1% Resistance
Parameter 3: +5% Health
Parameter 4: +1% Resistance
Parameter 5: +5% Health
Parameter 6: +1 Attack
Parameter 7: +1 Initiative
Parameter 8: +1 Rune
Interestingly, this includes the Witch Hunter, where the list is otherwise made of ranged magical units. They appreciate Health and resistance more than several of the other folks in this list, so this is nice.
High Level
Includes: Cyclops, Troll, Jotun, Red Dragon, Green Dragon, Black Dragon, Ice Dragon, Bone Dragon, Necrox, Tirex, Archdemon, Ogre, Orc Chieftain, Rune Mage, Giant, Ancient Ent, Snow Falcon.
Parameter 2: +1 Attack
Parameter 3: +1 Speed
Parameter 4: +10% Damage
Parameter 5: +1 Rune
Parameter 6: +10% Damage
Parameter 7: +1 Defense
Parameter 8: +1 Initiative
Basically, Level 5 units collectively have their own class, instead of being lumped into one of the melee classes or one of the ranged classes. Naturally, it's a really good class, with pretty much every major non-specialized bonus in the list.
Particularly worth pointing out is that Giants and Ancient Ents can thus reach 2 Speed, giving them much higher potential utility than in prior games.
Vikings
Includes: All Viking units.
Parameter 2: +1 Attack
Parameter 3: +1 Initiative
Parameter 4: +1 Rune
Parameter 5: +1% Crit chance
Yes, Vikings have a class all to themselves just to make them better. Though for several Vikings the Initiative bonus is redundant with their other class.
Basically, it slants them toward aggression and Runes, which is in line with their faction design overall.
Level 4 Damage Bonus
Includes: Alchemist, Cannoneer, Engineer, Advisor, Elder, Brontor, Chosha, Ram-Thor, Winged Shade, Necromancer, Evil Eye, Gorgon, Contemplator, Royal Thorn, Royal Griffin, Demonologist, Demoness, Pyromage, Knight, Paladin, Jarl, Mystic, Soothsayer, Shaman, Blood Shaman, Ent.
Parameter 2: +10% Damage
Parameter 3: +10% Damage
Level 4 Damage Bonus is there to make Level 4 units get a Damage bonus. In conjunction with High Level giving Level 5 units bonuses to Damage, almost all units above Level 3 have the advantage over lower-Level units of gaining actual Damage boosts, encouraging using higher-Level units in the long haul, given how important base Damage is to a unit's utility.
Do note however that Damage bonuses from leveling are... applied erratically. Some units apply the bonus to their attacking Talents. Some units do not. There's no pattern that I can identify, and it can be fairly counter-intuitive in its behavior, with Talents that are essentially a variation on a normal attack failing to benefit while weirder stuff like the Tirex's Primal Fear Talent does benefit from Damage increases from leveling.
At least the Talents update their displayed damage appropriately, so you can readily tell... though of course it's unhelpful if you're eyeing a new unit, wondering whether it'll be worth leveling it or not.
-----------------------------------
I'm not entirely sure how the process of stat selecting from leveling is handled in its details. I do know that it's random, and that the AI and player are operating on different rules.
For the player, unit level-ups run off the regular RNG seed used as one battles and all. If you do the same things, you get the same level-up bonuses on a given unit, but if you do different things, you might get different bonuses. (Early levels in particular are so limited in their options that different parts of the RNG seed can easily output the same results as each other) Note that this is universal to a unit type; once your Jarls are Level 4, whatever bonuses they got apply to all Jarls you ever own, even if the stack wipes completely or the like.
For the AI, level-up bonuses are instead defined at worldgen. So every enemy Zombie will have the same level-ups as every other enemy Zombie, aside the detail that Zombies in one area might be a lower level than Zombies in a different area. Note that looking at a unit in AI hands in the late game will give you an idea of what that unit can have at high levels, but it's not going to be informative of exactly what your own units will have at Level 8.
Notably, the game doesn't seem to enforce minimum guarantees of any kind. I've had cases where I raised a unit to Level 10 that included Speed as a potential gain by class, and that in AI hands did get Speed, but for me capped out its level without ever gaining a point of Speed.
From experience, I think what the game does is randomly pick a boost three times per level-up out of all the possibilities a unit has access to, with the enforced minimum levels seeming to force the game to re-roll if a boost can't be selected that early. This is probably why the Base class duplicates three possibilities three times apiece: to bias level-ups toward its effects.
That said, I have seen units gain 4 separate boosts from a single level-up, so there's got to be more to it than that.
Anyway, one of the main takeaways of level-up bonuses is that in the late game basically anything that isn't a dedicated archer -and even some of those- has the potential to pick up a point of Speed, which has a fairly pronounced impact on stuff like how effective eg Freeze's 1 Speed reduction is on melee units. This further contributes to the Warriors of the North fast-paced gameplay, since it's a lot harder to stall out enemies, and your own melee can often get to the fighting sooner, in the late game.
Some other points of note:
-Experience requirements scale fairly rapidly: the experience requirements per level work out as 100/250/500/1000/1800/3000/4800/7000/10000. This means that reaching Level 10 takes more than twice as much experience as reaching Level 8 does! (Level 10 is the maximum, incidentally, which is different from Red Sands where max level is 20)
-5 experience is the 'default/minimum' value broken out for eg Talents that don't target other units, 'killing' an Ice Spike, etc, though a unit may gain less than that from certain actions. (I've seen a Tirex gain 3 experience from using Primal Fear, for example)
-How much experience you can gain from attacking enemies is capped by your unit's current level: at the first level units can only gain 15 at max, then 20 for the next three, then 25 for the next three, then 30 for the last two. (Discounting Level 10, of course, where you can't gain experience at all)
-Non-lethal Talents that target specific units actually scale experience in a similar way to lethal ones, except they seem to have more generous calculations: a Gorguana may find itself getting 25 experience for attacking an enemy stack and 27 for slapping Mark of Blood onto it. This even applies when targeting allies, and so units with such Talents can generate 'free' experience quite rapidly.
Lastly, have a few details that technically exist but... don't matter much.
-The player's class actually influences unit experience gain, with the Viking having the best modifier and the Soothsayer the worst. (The exact numbers are 20 for Viking, 17 for Skald, 15 for Soothsayer, but I don't know how they plug into the formula exactly)
-The game applies modifiers to different attacks on units as well, where melee attacks gain experience fastest, then regular shooting actions, then magic shooting actions. The exact modifiers are 1, 1.2, and 1.4 respectively, where these are bigger divisors as you go up, and so produce smaller numbers. (So melee is 100% experience, regular shooting actions are about 83.33% experience, and magic shooting actions are about 71.5% experience)
-Experience gain slowly drops off as combat drags on, presumably in an attempt to prevent infinite grinding.
-Shots that are fired beyond a unit's maximum effective range give different experience from shots fired within its maximum effective range.
I say these don't matter much because even if you're playing a Soothsayer, focusing on magic ranged attackers, and combat drags on a bit (ie a combination that should noticeably reduce experience payout), it's pretty normal for a unit's final experience from an action to be defined instead by the arbitrary cap on experience per action I covered earlier, where the formula clearly outputs some number higher than the cap and then it gets clamped to the cap.
This is pretty unfortunate... I like these mechanics in theory, to prop up the Viking and give more incentive to use melee attackers compared to prior games, but the issue of ramming into the cap means they don't actually do those things.
-----------------------
And with that we're done covering what I know for a fact about the experience system, coupled with some speculation.
So back on to the Vikings it is.
See you then.