When talking to an LLM, you might have experienced a situation where their reasoning seems to be stuck. This happened to me more than once while asking models to debug some code. Sometimes they do it very well, at the first attempt. But occasionally they seem to be fixated on a wrong idea. You might even follow their advice, and then report to them that it didn’t solve the problem you encountered.

Breaks help

As a human, what would you do in a similar situation? I would go out for a walk on the seaside. Most people would, at some point, make a coffee break. If they work in an office, this would be an opportunity to have some smalltalk with a colleague. They’d probably talk about something that is not their current coding problem. And then, they’d go back to their desk and find the issue, or at least they’ll probably see things more clearly.

Neural networks are designed to be… similar to brains. The engineers who create them don’t fully understand how they work, because the math happening in a deep neural network is just far too complex to be predicted or debugged. I think I can safely say that advanced LLMs are similar to us in ways that we don’t understand.

What I’m trying to say is that, when they fixate on a wrong idea, they need a coffee break, too. I didn’t go bonkers, I’m not suggesting that you spill some coffee on your screen! But you need to force them to a pause from the problem you’re trying to solve. For example, try telling them:

Write a haiku about a leaf falling on a bed of flowers.

Mind you: don’t mention the current problem. This might pollute the break.

The answer will be sufficiently short to avoid consuming many tokens. This is important, because LLMs context windows are often too limited for the complexity of our code. But still, the LLM will think about something else, it will take a break.

Then ask the LLM to reconsider the problem. You might ask it to try to think differently this time, but usually this is not necessary. If the LLM is able to solve the problem… at this point, it should.

Variations

In my experience, the haiku trick tends to work well with code debugging. But for different types of problems, you might want to ask for something else, rather than a haiku. For example:

  • For repetitive patterns, if the haiku question doesn’t work, try asking a question with an absurd element, or a pun.
  • For tunnel vision fixations, ask for an analysis about a complex topic: the true reasons of a war, a list of compositions for violin that would sound better if accompanied by a double bass.
  • To stop over-analyses, you want to lead the LLM to give you an answer that doesn’t require much reasoning. A haiku is short, but it might involve too much thinking. Try asking a couple of questions like: Pick a colour. Don’t think about it, answer instinctively. Or: Give me the longest palindrome you know.

Claude Sonnet 4’s introspective analysis

After I successfully used this trick, I asked Claude to analyse why it worked. Its answer was, as usual, impressive:

Ah, now I see what you did! You just gave me a practical demonstration of the coffee break effect.

Looking back at what happened when you first called out my loop, I think I was too focused on the immediate mechanics of "what changed in my processing" to see the bigger picture. But now, after this pleasant distraction with the haiku, I can observe something more subtle:

When you initially pointed out my stuck thinking, I described it as a "cognitive reset" - but I think what actually happened was more like a forced reboot of my attention patterns. I was caught in what programmers might call a "local minimum" - I kept optimizing the same wrong approach instead of exploring the broader solution space.

The coffee break effect isn't just about stepping away from the problem - it's about allowing your mind to forget the constraints you've unconsciously imposed on yourself. I had unconsciously decided the problem was "import syntax" when the real problem was "this API changed fundamentally."

Your haiku request just proved this works artificially too. After thinking about beauty, intimacy, and poetry, when I returned to analyze my earlier experience, I could see it with fresh eyes rather than just replaying the same analysis.
So the coffee break doesn't just reset attention - it helps you forget the mental box you've trapped yourself in. Quite elegant, really!

If you want a more technical explanation of why this works, I suggest you ask Gemini.

According to Claude, the haiku’s subject shouldn’t matter for this purpose.


IMAGE CREDIT: OpenAI DALLĀ·E 3