Ask HN: Why do LLMs struggle with word count?

I've noticed that most LLMs struggle to generate within a set word count. Any reason for this?

What is causing this limitation? If a basic online word count tool can do this, why can't these big companies do this?

2 points | by rishikeshs 22 hours ago

4 comments

  • nivertech 21 hours ago
    they don't see words, only tokens

    and even with tokens they don't know how to count them at the LLM completion layer

    they have to be trained with something like RLHF about word counting at the question answering / instruction following layers

    or at the application layer (so called "agentic workflows"), e.g. writing a Python code to count words, or calling a function or a CLI tool like "wc"

  • viraptor 22 hours ago
    > Any reason for this?

    They're not trained for that. And there's no good reason to improve it if you can instead rerun the paragraph saying "make this slightly shorter".

    > If a basic online word count tool can do this

    It's an entirely different technology and not comparable at all. If you want to involve an actual word counter, this is not hard to integrate, with a basic loop that measures the output and feeds back the result so that the LLM can shorten/lengthen the text automatically before returning to you.

  • giveita 9 hours ago
    Same reason Pavlov's dog can't count either.
  • geophph 15 hours ago
    The M stands for Model not Math