swarming isn't ideal for attacking entrenched position at all.

in fact, that's what you hope for as an entrenched defender, for the enemy to mount frontal assaults using huge numbers that will only increase your kill ratios.

I suggest using artillery etc. to pound away at the enemy so as to force them to either take the casualties or come after your arty. the latter usually occurs.