AI Studio Playground: Gemini repeats large code outputs, ignores batch boundaries, and sometimes gets stuck in self-referential response loops (XHIGH)

I’ve been experiencing some really strange and frustrating behavior when using Gemini 4 Hydrogen in the google AI studio playground, with thinking set to extra high.

I primarily use gemini for development on fairly large projects. Since the playground workflow I’m using doesn’t provide a convenient way to receive modified files or archives directly, I have to receive source code as code blocks and manually replace the corresponding files in my project.

To make this manageable, I usually ask the model to split its work into small batches (no more than two files per response), especially when the files are large. It maintains a plan of which files need to be delivered and in what order.

Unfortunately, I’ve been running into several problems with this workflow.

1. Repeated code output within a single response

Sometimes, when I ask gemini to send two large files, it generates the same files multiple times within the SAME response.

I’m not talking about accidentally asking it to repeat something in a follow-up message. It can literally output the same two files three or four times in one response.

This causes several problems:

  • Massive unnecessary output token consumption.

  • Markdown and code block formatting can break, especially with large files.

  • The response becomes extremely difficult to work with.

  • The repeated content makes the conversation history unnecessarily large and can seemingly interfere with the model’s ability to keep track of what was actually delivered.

2. Ignoring explicit batch boundaries

Another issue is that gemini sometimes seems unable to stop after completing the requested batch.

For example, the workflow looks like this:

  1. I ask gemini to send the next two files from its implementation plan.

  2. It sends both files.

  3. At the end, it explicitly says something like: “Replace these two files and let me know when you’re ready. I’ll send the next two files in the next batch.”

  4. However, immediately after writing that, it starts sending the next two files anyway, within the SAME response.

This happens even though it has already explicitly acknowledged that it should wait for my next message.

I have to manually stop generation and sometimes use the regenerate prompt feature to get it back on track.

3. An especially bizarre self-referential response loop

This is the most unusual incident I’ve encountered so far.

In one recent session, Gemini had just output more than 3,200 lines of code. Instead of stopping there, it continued generating an extremely long, self-referential monologue within the same response.

It began questioning whether it had already sent its response, whether the previous message had actually reached me, whether its current generation had finished, and whether it should wait for another user message.

It repeatedly contradicted itself:

  • “I’ve already given the full response!”

  • “Wait, am I still generating the response?”

  • “Did I actually send the file?”

  • “There is no user message after my previous response.”

  • “Maybe the platform hasn’t finalized the turn?”

  • “I should NOT resend the entire 1,200-line file.”

  • “Should I output nothing, or just a short sentence?”

It kept analyzing its own message history and speculating about the state of the playground interface, repeatedly reconsidering the same questions.

At one point, it even started reconstructing the conversation structure and reasoning about whether its previous response had been delivered to the user or whether it was still part of the same generation.

Eventually, after this entire internal debate, it decided that the safest thing to do was append a short sentence:

“Ready for the next step whenever you are.”

And that was the end of the response.

I’ve attached a screenshot of this incident. It contains a mixture of English and Russian text, including fragments of the surrounding conversation. I’ve provided an explanation of what happened above, but the screenshot itself is unedited and shows the original playground output.

Honestly, I’ve never seen anything quite like this before. It almost looks like the model is trying to figure out whether it has finished sending a message while continuing to generate that very same message.

4. Could my custom instructions be contributing to this behavior?

There is one additional detail that might be relevant.

I use a set of general instructions for my software development sessions. They were originally written as a short instruction block for claude, but I’ve also been using them with gemini.

The instructions are intended to encourage accuracy, careful implementation, consistency with the existing project, and thorough verification rather than rushing through tasks.

For transparency, here is the instruction block (translated from the original russian):

The main priority is accuracy, quality, and factual results, not speed or the appearance of having completed the work.

  • Don’t invent facts, verification results, or tool capabilities. Distinguish confirmed information from assumptions. Be honest about errors, limitations, and unverified areas.

  • Take the project’s history and previously approved decisions into account. Do not reinterpret feedback: change only what the user explicitly requested.

  • Before starting work, study the existing implementation and its dependencies. Preserve working components, architecture, and compatibility. Avoid unnecessary changes, refactoring, and unilateral decisions.

  • Do not present a partial result as complete.

  • Before execution, critically check the result for errors, missed requirements, edge cases, and side effects. Recheck the affected areas and fix any problems found.

  • Do not make significant assumptions about the user’s intentions. First use the available context, and ask a specific question when something is ambiguous.

Working principle: study → check → double-check → critically double-check → execute.

I originally created these instructions specifically for claude, and I don’t know whether they are equally suitable for gemini’s reasoning behavior.

I’m wondering whether some of these instructions, particularly the repeated emphasis on verification, double-checking, critically reviewing results, and not treating partial progress as completion, could unintentionally encourage excessive self-checking or contribute to the strange loops described above.

For example, could the combination of these instructions and XHIGH lead the model to repeatedly reconsider whether its work is complete, even after it has already delivered the requested output?

This is just a hypothesis, not a conclusion. I have no evidence that these instructions are the actual cause, and I would be interested to know whether anyone has observed similar behavior with or without custom instructions.

What I’m wondering

I’m trying to figure out whether this is a known issue with AI studio, a model-side generation problem, something related to how the playground handles long streaming responses, or potentially an interaction between these factors.

A few questions:

  1. Has anyone experienced similar behavior with gemini in AI studio, especially when generating large amounts of code?

  2. Could this be related to streaming, response termination, or the playground somehow mishandling the boundaries between model turns?

  3. Is there a known workaround to prevent repeated output and unsolicited continuation after the model explicitly says it is waiting for user input?

  4. Could very strict custom instructions asking the model to verify its work, maintain a multi-step plan, and avoid treating partial progress as completion contribute to these loops?

  5. Has anyone noticed differences in this behavior when using XHIGH compared to lower thinking levels, or when using different custom instructions?

The problem is that the response delivery and turn management can become unreliable enough to make long development sessions extremely frustrating.

I’d really appreciate any insight from people familiar with gemini’s behavior in AI studio, or from anyone on the google AI studio team who could clarify whether this is a known issue.


If you’d like to examine the full conversation in detail, feel free to use the screenshot itself. You can also upload it to gemini and ask it to translate the russian portions into english and summarize the entire exchange.

the screenshot is unedited and shows the original playground output

It looks funny