---
title: "LLMs Are Bad at Being Forced"
url: "https://www.morphllm.com/blog/llms-bad-at-being-forced"
description: "The further you push language models from their natural output patterns, the worse they perform. Understanding why reveals fundamental truths about how these systems actually work."
date: "2025-06-01"
author: "Tejas Bhakta"
---
# LLMs Are Bad at Being Forced

# LLMs Are Bad at Being Forced

Hand a concert pianist a pair of ski gloves, dictate the fingering, and you'll still get the Chopin. Recognizably. In mittens.

That's roughly my mental model of a language model under output constraints. There's a distance between how the model would say something and how your system demands it be said, and quality decays as that distance grows. The part that surprised me was finding out someone had measured the decay.

## Where the model is at home

An LLM is autoregressive. One token at a time, left to right, each pick conditioned on everything already written, and no backspace anywhere in the loop. A token, once out, carries every token after it, right or wrong. The picks themselves come from a feel for what-reads-right that the model absorbed from billions of examples of human writing, production code and blog posts and Slack threads alike.

So when you just ask for a function, you get one:

```python
def calculate_fibonacci(n):
    if n <= 1:
        return n
    return calculate_fibonacci(n-1) + calculate_fibonacci(n-2)
```

Nothing in there fights the model. It wrote that shape a million times in training, give or take.

## The box

No production system leaves the model alone like that, though. Products need output they can parse, so the model gets boxed in with constrained decoding, which literally bans illegal tokens at each step of generation. Tool calling is the everyday case. The model owes the parser JSON:

```json
{
  "function_name": "calculate_fibonacci",
  "parameters": {
    "n": 10
  },
  "code": "def calculate_fibonacci(n):\n    if n <= 1:\n        return n\n    return calculate_fibonacci(n-1) + calculate_fibonacci(n-2)"
  }
}
```

Same fibonacci. Except the `code` field is one long escaped string now, and whoever's writing it holds down two jobs with one attention budget. Solve the user's problem. Also, never miss an escape. The second job bills its hours against the first.

## What aider measured

I lean on [aider's benchmark](https://aider.chat/2024/08/14/code-in-json.html) for this argument a lot, partly because they weren't trying to make my argument. Four models (Claude 3.5 Sonnet, DeepSeek Coder V2, two GPT-4o variants), 133 coding problems, each problem run twice. Once as plain markdown. Once as the same code inside a JSON wrapper.

Markdown won every matchup.

The result I actually quote at people is the weird second-order one. Sonnet took the largest hit, and Sonnet does not fumble JSON syntax, basically ever. Its failures were extra bugs in the code itself, bugs that don't appear when the identical code is written as markdown. Which rules out the comfortable explanation (models are bad at wrappers) and leaves the uncomfortable one: the wrapper taxes attention, and the tax comes out of the logic.

Remember there's no backspace. Somewhere mid-string a quote-escape goes wrong, and forty plausible lines get built on top of the wrong one, none of them able to look down. That's not a typo anymore. It's a foundation.

## Thinner and thinner ice

I rank output formats on one axis now: how far is this from text the model actually read? Markdown, very close. Code-in-JSON, further. The `SEARCH`/`REPLACE` edit blocks half the coding tools use, with their ritual markers and their divider that must land character-perfect, further again. Keep going and you reach my unserious limit case, demanding a compiled binary. Nothing could be easier to parse. Nothing could go worse.

Two costs climb together as you slide out that axis. The obvious one: ceremony eats a growing share of the token budget that was supposed to buy your fix. The quiet one: each banned token shoves the next pick onto ground the training data barely covered, and the loop that can't backspace turns any slip there into forty lines of confident wrongness. Same model at every notch. Thinner ice under it.

## The engineering trade

Structured outputs won for a reason. JSON parses; freeform text gets scraped with regex and prayer. Nobody should ship the latter.

The mistake is treating structure as free. It isn't, and the bill scales with strictness, so the game is to buy exactly as much structure as parsing requires and not one marker more. Keep the model's output as close to writing as your system can tolerate, then handle the gap on your side of the wall.

Every capability jump makes this truer, not less true, because what improves is the model's command of language as humans write it. A model at its best sounds like reasoning, hedging, thinking out loud. The strong interfaces let it do that and then extract the structure downstream. A form submission gets you the mittens.

## What we did about it

At [Morph](https://morphllm.com/), we took Cursor's side of this argument and built infrastructure around it: bend the system to fit the model, never the reverse.

Fast Apply exists because of everything above. Claude and Gemini write code changes the way they'd naturally write them, no bespoke edit format, no escaped strings, and the merging happens on our end instead, at 10,500+ tokens per second. The merges come out better too, for the exact reason aider's benchmark predicts: the model's attention went into the change, not the ceremony. None of that is a speed tweak. It's the bet the company is built on. Work with the grain of the model and you collect its full output. Work against it and you're sanding down the thing you paid for.

---

*Want the numbers? The aider.chat team published the full [benchmarks](https://aider.chat/2024/08/14/code-in-json.html) across every model they tested.*
