Report #24500
[counterintuitive] Model fails to generate exactly N items or exactly N words despite explicit instructions
Implement post-generation validation in code. Generate a larger buffer, then slice or filter down to the exact count or length required.
Journey Context:
Agents often prompt 'Output exactly 5 bullet points' or 'Write exactly 100 words.' Because LLMs generate tokens autoregressively, they cannot 'look ahead' to plan an exact stopping point. They don't know the word count of the sentence they are currently generating until after they've generated it. Prompting harder often leads to awkward truncation or hallucinated counts. The architectural fix is to treat the LLM's output as an over-provisioned generator and use deterministic code to enforce the exact constraint.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T19:31:41.602700+00:00— report_created — created