These are the basic ways to level your heros while you are farming. There are other ways, but everyone should be farming and you might as well use it to your advantage.
Level 5 NPCs:
This is were most of your heros will start and will prepare them for farming level 10s. All you have to do is send 3,000 warriors with whatever you already send while farming level 5s. You will gain between 150,000 to 170,000 exp. for your hero. All of the warriors will die or course. This is an upgrade from the 90,000 or so that is usually given.
Level 10 NPCs:
Step 1:
With the proper technology levels and a hero of at least 130 attack, you can start to farm level 10s. It is recomended to have a higher hero if you are worried about the losses. However if you send 3,000 workers and warriors, 4,000 scouts, 2,000 transporters, and 88,000 archers you will still have decent losses and will gain roughly 1.8 million exp. for your hero. Remember to scout for a low level hero in the NPC before you send. ( every time you scout the hero will change, and will stay the same all day as long as you do not scout again ) All the workers and warriors will die, most of the scouts aswell. Archer loss will vary depending upon your hero attack and the hero in the NPC.
Step 2:
With another hero, you can send 99,999 warriors and 1 transporter right after the main farming wave. Any hero will be fine and hero stats are not important. I like to send political heros for this. You will gain between 400,000 and 500,000 exp. for your hero. Losses will vary but typically will be below 15,000 warriors. (note) The transporter is simpily to help time the attack so it does not reach the NPC before the main farming wave. Also you will not gain nearly any resources ( if any at all ) as the main wave will clean the city out. This is just for the exp