My observation is more about the choice, faced with stalemate, to continue repeatedly to mount massed offences against the evidence that they didn't work at anything like acceptable cost. What is interesting is how the Germans managed to start a successful offensive in 1918, making significant progress before their resources ran out and they couldn't sustain the front line any longer.
Indeed. I believe it was mostly the Allies that mounted mass offensives in WW1, but I don't know why Germany succeeded initially in 1918 when none of the previous attempts had made much difference beyond causing mass casualties.
Though of course one of the reasons the offensives, on both sides, were effective at restoring real movement to the frontline in 1918 was four years of learning that had been accrued by that point in the war. A lot of lessons and new technology all coming together in the same place at the same time was a very important factor in overcoming the primacy of the defence that had been so difficult to counter up until that point.
As for the German successes in early 1918 that's in large part due to not only adapting their tactics on assaulting trenches but perhaps most importantly the arrival of large numbers of troops from the Eastern front following the armistice with Russia in December 1917 which released somewhere in the region of one million soldiers for service on the Western front. This gave them more troops to commit to offensive actions again but also allowed the rotation of troops off the frontline to retrain with new tactics for to then use in the offensive itself (which was absolutely a last throw of the dice for Germany).
On the part of the Allies and their continued attempted offensives in the West during the war I would note firstly that the Allies in some respects didn't have the choice. The Germans had, after all, swept through most of Belgium and large tracts of northern France. I'm not entirely convinced it would have been a sustainable position to simply sit back on their heels and wait for something to happen for an unknown period of time. We know that the Americans will join the war in 1917 with large number of troops arriving in 1918 whilst the German domestic position will become intolerable by mid/late 1918. I'm not sure that in 1915 or 1916 it was at all obvious that either of those situation would pertain nor in 1917 that the German home front would collapse twelve months later. Especially for the French whose territory was occupied I'm not sure just sitting on their hands would really have been a practical strategy.
Equally it's perhaps unfair to accuse only the Allies of repeated massed offensives as that rather ignores the biggest battle of attrition of them all which was specifically designed and intended to cause massive casualties that being the Battle of Verdun which was planned by the Germans to "bleed France white". It perhaps doesn't get the play that it should in the UK because it involved only the French and Germans but at somewhere north of 700,000 casualties (killed, wounded and missing) in nine months of fighting in 1916* it was an incredibly costly battle entirely designed to inflict casualties by hitting the French somewhere that they would have no choice but to defend and defend hard. Indeed the Battle of the Somme in 1916 started when it did precisely to try and relieve pressure on the French by drawing off German troops into another sector of the frontline. Something which, despite the utterly horrific opening day losses suffered by the British Army, it did very effectively. Whilst one could argue that Passchendaele was launched and continued longer than it should have in 1917 in part to help cover for the French Army becoming almost combat ineffective for a decent chunk of 1917 due to widespread mutinies within the Army during the first half the year and then the rebuilding that was required during the rest of 1917. The British Army had to do something to engage the Germans and prevent them going on the offensive against a shattered French Army during that time.
Were the offensives of the early and middle parts of the war too costly and, often times, poorly managed? For sure. But equally they weren't just blundering around Blackadder style with
Haig using a dustpan and brush to sweep up troops and
Melchett observing a 1:1 scale chunk of soil that had been recaptured at great cost.
But in any event it is unarguable that by 1918 the Allies had learned how to fight and win battles on the Western front to the point that they defeated the German Army in the field in 1918 and would have advanced on to Germany proper in 1919 had the war not come to an end in November 1918. That isn't a war that was just a stalemate...
Certainly the Allies and their leadership are not blameless for the losses suffered. There is some utterly unforgivable mismanagement (day one of the Somme is probably the best example of this on the British side) of the combat on the Western Front but again, I would strongly suggest it is extremely simplistic to the point of being inaccurate to simply reduce that war to "it was unmitigated slaughter caused by inept Generalship and nobody achieved anything of note until one day they stopped fighting because everyone had had enough" or similar.
*I can recommend The Price of Glory by Alistair Horne for a fairly short but gripping history of the battle if anyone would like to learn more.