Training gets exp on per-unit base to each unit type(only if troop lvl is below trainer lvl?)
Example(random numbers): you need 800 exp to promote one man-at-arms into a knight and your training lvl gives each unit in your army 80 exp per day.
If you have 10 man-at-arms - their unit type will get 800 exp totals and 1 of them will get promoted. On day 2 - none gets promoted, as they got save up only 80*9=720 exp. On day 3 its 720+720, on day 4 its 8*80 and etc. So having 1 last man-at-arms will take around 10 days to promote to a knight.
Battle exp - divided between all units evenly, and added up by type same way as training. So 10 man-at-arms in a 100-man army with 10 knights being the only top-tier units(no more upgrades possible) will get 1/9 of all the exp(100-10=90 total units needing exp to lvlup, so 10/90).
Also, an exping advice. When the battle is over, there are two experience phases, 1st one accessable only if there is at least one prisoner or recruit(the capture/recruit screen).
Thing is, here you can allocate experience the units gained directly from taking part in battle - what or who units of each type killed - that gets sumed up by unit type again.
If you upgrade units here, then the next experience phase is the one you see on the world map - experience from the battle as a whole, divided between all units.
And the catch is that if you change a unit's type in 1st phase(upgrade), on second phase he is counted in the new group.
Example using upper example: an army of 10 footman, 1 man-at-arms, you.
After battle in capture phase 9 footman can be upgraded. Total battle exp is 960.
If you upgrade them, in battle exp phase you have 10 man-at-arms,1 footman and 1 hero. Each unit gets 1/12 = 80. 10 man-at-arms get 800 exp total and thus you get 1 knight.
Results: 1 footman, 9 man-at-arms, 1 knight, 1 hero.
If you do not upgrade footman in phase one, the 2nd phase is 1 man-at-arms with 80 out of 800 needed exp and 10 footman, ready to get upgraded to man-at-arms.
Results: 0 footman, 11 man-at-arms(+80 out of 800 reserved exp), 0 knights, 1 hero.
See the difference?