Danger rooms are the hax solution. Place 10 wooden spears in an upright spear trap, then link it to a lever, and set the lever on repeat. Have your FULLY ARMORED soldiers stand there and deflect the wooden spears, quickly gaining skill in dodging, armor use, shield use, and parrying with weapons, at a rate of about 10 hits per ~75 frames. Insta-legendary.
Lowering squad size helps a lot too, as previously mentioned. They tend to wait for everyone to show up, so if "everyone" is just 4 dwarves, it's easier to get everyone together. The other 6, you can usually leave 3-4 off duty to let them rest, eat, drink, etc, and I usually set 1-2 patrolling the walls, just to give them something to do and perhaps notice an incoming ambush.
Personally though, I always prefer live training. Capture anything using cage traps, build the trap, station your military at it, and then release it. You can disarm goblins by d-b-d their cage, which causes the dwarves to haul everything to the dump, separating the clothes and weapons from the goblin, but you'll need to reclaim the cage afterwards. Live training is the most effective, non-cheaty method at training up to ~level 5 or 6. After that, they don't gain much exp because they kill too quickly. A soldier slapping a goblin with a wooden sword will take a while to kill it, and gain a lot of skill. A soldier who takes one well-aimed blow and cracks a skull, will only gain 1 hit worth of exp. So, you can easily get them up to killing speed with live training, but real warfare turns them from 5's to 18's.
Also, pump operating. I make all my melee soldiers pump operators, and place pointless pumps. They must be actually moving water to function, mind you. They skill up in pump operation, so all your soldiers are in nice orange clothes and easy to notice even when civilian, and it adds to their "tough", "strong", "slow to tire" and other important military traits. They'll be more likely to hit for a kill, less likely to sustain injury, and fight longer without becoming exhausted. Just keep in mind that anyone operating a pump will act as if under military orders, and will become very thirsty before they take a break, so you can get bad moods from this at times. 3-4 training, 3-4 pumps, and 2-4 inactive is pretty good. This ensures that someone is always training, someone else is getting better stats, and a few are left to tend to personal needs.