Skip to content

M1 Max Qwen3.8-27B agent repeats successful tool calls on 0.3.6.2 (also seen on another runtime) #76

Closed

Description

@tonydehnke

Summary

On an M1 Max Mac Studio, a Qwen3.8-27B coding agent using TensorFold 0.3.6.2 repeatedly generated successful, near-identical shell tool calls instead of moving from a reproduction test to a fix. The same pattern occurred on 0.3.5.1; two full runs eventually filled a 65,536-token context and received the expected HTTP 400. I am reporting the observation for triage, not claiming TensorFold is the proven cause: a short run with MTPLX 2.12.0 and the same agent/task also repeated a search.

Environment

  • Mac Studio M1 Max, 64 GB RAM; macOS 27.2 (26B5091g).
  • TensorFold 0.3.6.2, tagged source commit 71377a5373ed7b394f1b480ba2a6a3986b03af1c; MLX 0.32.2, mlx-lm 0.31.3.
  • Target: mlx-community/Qwen3.8-27B-4bit revision 10c35caafbb80f7dc6a7a432cdd11af10a6d4818.
  • Drafter: z-lab/Qwen3.8-27B-DFlash2 revision 50307d4c4cde6860d4eee73e2547cd786fe8e8a4, 4 bits.
  • Server: --context 65536 --no-thinking --temperature 0 --max-tokens 4096 --parallel 1 --drafter <retained local DFlash2> --drafter-bits 4.
  • Client: Lemans 1.4.0 miniswen coding agent, one request at a time, synthetic Rails redirect task. The 0.3.6.2 check was deliberately capped at 20 agent steps/10 minutes. No task solution or hidden verifier was included in the model prompt.

Observed

The agent inspected the controller and existing tests, then wrote and ran repro_test.rb, followed by repro2_test.rb through repro11_test.rb. These variants tested the same redirect behavior. The last seven tests each returned three runs and zero errors; the agent did not edit the controller. It reached the 20-step diagnostic limit. There were 20 completed model requests; the last prompt was about 9,925 tokens, so this early repetition did not require a long context or trigger a server error. The diagnostic's verifier returned reward 0.0 because no fix was made; this is not a full scored benchmark result.

Two earlier full runs on TensorFold 0.3.5.1 wrote and ran 101 and 93 numbered redirect probes, respectively, then hit the configured context limit before grading. In the latter, the rejected request had 61,795 rendered prompt tokens plus a 4,096-token reply allowance. A separate, 20-step MTPLX 2.12.0 diagnostic on the same task repeated one identical return_to search seven times. This cross-runtime result makes model or agent behavior a plausible explanation.

The 0.3.6.2 run had no CI worker, no new swap, a 20.43 GiB peak model footprint, and a minimum macOS memory-pressure free reading of 49%. The server started and served tool calls without HTTP errors. The owned processes and isolated VM stopped normally.

Expected / question

After a successful reproduction, the agent should move to a code change or a materially different diagnostic, not keep creating numbered copies of the same test. Is there a TensorFold inference or tool-call behavior worth checking here, particularly on M1–M4 with drafted Qwen3.8? I can run a small, redacted prompt replay comparing serial and drafted output if that would help distinguish server behavior from the model/agent loop. I have kept the full trajectories locally; I have not posted benchmark task text or hidden checks.

Activity

  1. tonydehnke commented on Sep 28, 2026

    @tonydehnke
    Author

    I ran one bounded follow-up on the same M1 Max, TensorFold 0.3.6.2, Qwen3.8-27B checkpoint and drafter, synthetic Rails task, Miniswen agent, 65,536 context, 4,096 output cap, and temperature 0. The planned change was --no-thinking to --thinking.

    With thinking enabled, the agent moved from reproducing the redirect bug to editing the controller, added regression tests, and finished in 13 model turns. The task's four independent verifier checks passed (reward 1.0). The earlier no-thinking run repeated similar reproduction tests through the 20-turn diagnostic cap without making the fix. This follow-up was also a 20-turn, unscored diagnostic; it does not turn either run into a comparable full benchmark score.

    The thinking-enabled run overlapped active CI, unlike the earlier no-thinking diagnostic. It completed through grading in 401 seconds, with a 20.76 GiB peak model footprint, at least 32% memory-pressure headroom and zero new swap or swap-out activity. All model requests completed and the owned server shut down cleanly. The CI difference and single run mean I cannot attribute the changed agent behavior solely to thinking mode.

    Together with the similar no-thinking loop seen on MTPLX, this makes Qwen settings and the agent's lack of a no-progress guard more plausible than a TensorFold-specific tool-call failure. I have no evidence yet of a TensorFold inference defect. I am leaving the issue open for your judgment; if no runtime investigation is useful, it is reasonable to close it. I can provide a small redacted replay comparing drafted and serial output if it would help distinguish runner behavior.

    One configuration caveat: both diagnostics used temperature 0 to isolate thinking mode. Qwen's published sampling guidance recommends different temperatures and penalties for both thinking and non-thinking operation, so these tests do not cover its recommended settings.

  2. ashhart commented on Sep 29, 2026

    @ashhart
    Owner

    Thanks @tonydehnke, and thanks for keeping the task text private. I checked whether our tokens are the model's own,
    on your checkpoint and flags.

    mlx-community/Qwen3.8-27B-4bit@10c35caa is byte-identical to the copy we test with (same file hashes on Hugging
    Face). With it: z-lab/Qwen3.8-27B-DFlash2@50307d4c at 4 bits, TensorFold 0.3.6.2 (71377a5), MLX 0.32.2,
    mlx-lm 0.31.3 and your server flags. We have no M1, so this ran on an M3 Ultra, which takes the same pre-M5 lane
    path. I built an agent of the same shape: a bash tool, a Rails return_to redirect task, tool results through the
    chat template, thinking off, greedy.

    • At 20 decision points (a 16-step agent loop and 4 replayed ones), the drafted reply, the "draft": false reply
      and mlx-lm's own greedy reply on the same prompt ids were the same tokens, down to the end token.
    • The prompts we render are the template's own rendering, token for token, with tool calls and tool responses in
      the history. Each next prompt carries the previous reply exactly as the model wrote it.
    • The loop reproduced. After 2, 3 and 4 passing repro tests, greedy wrote repro3_test.rb, repro4_test.rb and
      repro5_test.rb. Sampling at temperature 0.7 didn't break it: after 3 repros all three seeds wrote the same
      repro4 as greedy, byte for byte. In the looping run the model also repeated one identical command six times once
      the environment kept giving the same answer, much like your MTPLX search.
    • With thinking on, the same prompts went to the fix. The model worked out that reset_session drops return_to
      before the redirect and rewrote the controller, after 388 to 1,160 thinking tokens. After four repros it was
      still reasoning toward the same fix when it hit my 3,072-token cap.

    So I read this as the model continuing its own pattern under greedy decoding with thinking off, not a server
    fault. What helped here was thinking: drop --no-thinking, or send chat_template_kwargs: {"enable_thinking": true} for agent turns, and leave room for it in max_tokens. Sampling alone wasn't enough. On the agent side, a
    guard that notices a repeated command would catch it too.

    Two limits: this was an M3, not your M1 Max, and my prompts were 1.7K to 3K tokens against your ~9.9K. If you run
    your redacted replay, compare tensorfold.token_sha between a normal request and the same one with
    "draft": false. If they ever differ on your M1, that's our bug, and I'd like that prompt.

    I'll close this as the model's own behaviour rather than a server fault; please reopen it if a token_sha ever differs between a request and its "draft": false twin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions