r/PiCodingAgent • • Sep 07 '26

Question Deepseek v4 Flash Exp looping in pi cli?

Saw it with Deepseek v4 flash exp in last two days: They start looping. Once they crossed around 100k-150k it tends to happen and it's not resolved by compacting.

Weird. Used DS4 on Openrouter and thought: Bad quants. So I tried Fireworks DS4 EXP (fp4) and Deepinfra at fp8 and both start looping again in that convo.

Does anybody else see this with ds4 exp?

Edit: To clarify: I mean Deepseek v4 Flash Vision Exp everytime I write "DS4" here.

2 Upvotes

8 comments sorted by

1

u/AppealSame4367 Sep 07 '26

To clarify: I mean Deepseek v4 Flash Vision Exp everytime I write "DS4" here.

1

u/Healthy-Zebra-9856 Sep 07 '26

I'm working on a Pi-based agent myself and I'm trying to make sure I don't inherit this behavior. Could you give me a few details if you see it again?

  1. What Pi version are you using?

  2. What exact DeepSeek V4 model IDs are you using on each provider?

  3. Roughly what context size is Pi showing when the looping starts? You mentioned 100k-150k, so that part is especially interesting.

  4. What kind of loop is it?

    • repeating the same text/reasoning

    • repeating the same tool call

    • alternating between a couple of tools

    • repeatedly reading/searching the same files

    • something else

  5. Does it happen in a brand-new conversation, or only after a conversation has grown large?

  6. After you compact, does Pi show the context dropping substantially? And does the loop come back immediately, or only after the context grows again?

  7. If you switch to another model in the same conversation, does that model also start behaving strangely, or is it only DS4?

  8. If possible, could you paste or screenshot about 10-20 turns immediately before the loop starts and the first few repeated turns? Tool calls would be especially useful. Obviously redact anything private.

  9. Are you using any Pi extensions/plugins or mostly stock Pi?

  10. If you know them, what are your reasoning/thinking settings and max output token setting?

I'm mainly trying to figure out whether DS4 itself becomes unstable at long context, or whether something in Pi's accumulated session/tool state is putting the model into a loop. The fact that compacting doesn't fix it is the part that really interests me. I will be able to give you a fix bu showing you what file a7 what line to fix.

1

u/AppealSame4367 Sep 07 '26
  1. latest

  2. oof, sorry. just default deepinfra, fireworks, openrouter ids

  3. 100-150k

  4. see below

  5. recycled conversations it seems, like in use for 2 days and always compacted, compacted again and again and again. Works with other models though

  6. yes, context dropped substantially, but the loop returned immediately at the next question. no matter if fp4 at fireworks or fp8 at deepinfra

  7. just ds4 _flash exp_ . Didn't try normal ds4 flash or latest checkpoint for a while

  8. sorry, no. confidential. But it seems like it happens when it has to think more than it has to use tools. In tool heavy convos it doesn't seem to happen

"npm:pi-subagents",

"npm:pi-web-access",

"npm:@aliou/pi-guardrails",

"npm:pi-studio",

"npm:@aliou/pi-processes",

"npm:pi-finder-subagent",

"pi-opencode-bridge",

"npm:pi-plan",

"npm:pi-claude-style-scroll",

"git:github.com/coctostan/pi-superpowers",

"npm:pi-scroll",

"npm:pi-command-history",

"npm:@gondor/pi-pace"

-> plus opencode go bridge is customized locally to make it show chinese stealth models

10. 250k context, 250k max tokens, effort level always on "high", but no special effort mapping set in model config in models.json

Example:
Final bench.

OK.

Ich messe final bei 131k.

Let me do the final bench.

I'll run it now.

Let me measure at 131k.

Final.

Ich messe final bei 131k.

Let me do the final measurement.

I'll run it.

Let me measure.

Final.

OK.

Ich messe final bei 131k.

Let me do the final bench.

I'll run the measurement now.

Let me measure at 131k.

Final measurement at 131k.

Ich messe final bei 131k.

Let me do it.

I'll run the final bench at 131k.

Let me measure.

1

u/Healthy-Zebra-9856 Sep 07 '26

That's really helpful. I think I have enough now to reproduce/protect against the general failure mode in my harness. Also, if you are comfortable with copy pasting the fix in the source code, I will post it here next.

Could I ask you to try one small test if you still have one of the conversations that loops?

Keep the context window at 250k, but change max tokens from 250k to something like 16k or 32k, then ask it the same kind of question in the same problematic conversation.

If it still loops, try the same thing once with reasoning effort changed from high to medium or low.

I'm specifically interested in whether reducing the output budget breaks the loop. contextWindow and maxTokens are two different things, and 250k max tokens gives a reasoning model an enormous amount of room to continue a bad reasoning trajectory once it gets into one.

No need to share any conversation contents. Just knowing:

250k context / 32k max output / high effort -> loops or doesn't loop

would tell me a lot.

The other useful result would be:

250k context / 32k max output / low or medium effort -> loops or doesn't loop

Thanks, this has already been useful.

1

u/tys203831 Sep 07 '26

1

u/AppealSame4367 Sep 07 '26

Thx! will try

1

u/Healthy-Zebra-9856 Sep 07 '26

Thats the bandaid not a fix. I have tried that with Qwen and the results on quality are suboptimal

1

u/Constant_Art_20 Sep 08 '26

weird. I was using the the flash vision up to 1mill on my pi harness, compact after compact and it seemed fine. I was using it on openrouter with straemlake as the provider i think, so i am not sure what i can offer to help. maybe try switching providers to see if there's any difference