First, as folks posted, you should generally have enough ranged defenses to tolerate the first volley. In particular, dangerous crossbow marksmen will often prefer to wait for you to charge instead of taking shots unless they have high ground advantage, so a quick retreat will enable you to avoid most crossbow bolts.
Second, breaking their formation helps. There are 2 ways to get the raiders to break formation, after which slaughtering their archers isn’t really a problem. For one, if they are taking losses from your ranged units they will charge. For another, … I hesitated in sharing this cos I don’t want the devs to alter the AI, but I guess I’ve been abusing it enough.
If the AI thinks you are running away, they WILL break formation and charge. Because they have higher initiative, THE MARKSMEN WILL LEAD THE CHARGE. Unprotected and often out of action points, they make easy prey to your own ranged fire.
To convince the AI that you are running away, you have to fall back a certain number of brothers close to the edge. I’m not sure how many, but generally I’ll park my main fore on the hill to closest to the edge and send a few newbie brothers to the actual edge.