[GH-ISSUE #4908] [Engine] Metal batch slots (0.2.9): a picture request decodes other text once another request joins (slot rows rotate without M-RoPE) #2252

Open
opened 2026-11-04 01:57:56 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @oceanio on GitHub (Nov 1, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/4908

Area

Engine

Desktop app, Terminal or source?

Source (setup.sh or a build)

What happened

With --vision and "parallel": 2 on the Mac engine, a picture request gives different text when another request decodes beside it than when it runs alone. The requests are greedy (temperature 0), so the text should be the same, and two text requests side by side do give the same text. Nothing in the log or the response says anything, and the engine keeps serving.

I sent the requests through 0.2.9's own serve/server.py, with up to 400 tokens each. First each request ran alone, then in pairs, the second request starting 1 s after the first:

Pair First request Second request
text + text (T1, T2) same as alone same as alone
picture + text (I1, T1) differs same as alone
text + picture (T2, I2) same as alone differs
picture + picture (I1, I2) differs differs
picture + picture (I3, I1) same as alone same as alone (I3's 69 tokens were done before I1 started, so both ran alone)

The text matches until the second request joins, and differs from there on. I1 gives the same shape counts alone and beside T1, but its reasoning is worded differently from there: alone it says "First shape is a red circle. Second is a red circle.", and beside T1 it says "First shape: red circle. Second: red circle." I2's answer differs from its first sentence (both versions reached the 400-token limit before naming the bars).

Cause (from reading the code):

  • A request that is alone runs on the solo path, where mrope_sync copies the process's M-RoPE table into mrope_, and its positions are right.
  • When a second request arrives, both decode in slot rows. Their qsa_prep is built with function constant 30 only (metal/src/engine/window.cpp:953, qsa_prep#rows), not with the M-RoPE constant 24, so every slot row rotates by its plain cell position. After a picture, the text sits at fewer M-RoPE positions than it has cells, so it is rotated as if it came later. A text request's table is the identity, which is why text requests are not affected.
  • The slot-by-slot path (STRATA_METAL_BATCH_ROWS=0) rotates with mrope_sync, which reads the process's table. The last request that was read in rebuilds that table, so a slot would read another request's positions there too. I did not run that path.

A possible fix, which I have written but not yet run on the GPU:

  • Each slot keeps its own table (int32 [cells][3], 3.1 MB at 262K, allocated only with --vision).
  • slot_copy into a slot fills the slot's table from the admitting request's table: cells [0, upto) as they are, then one position per cell after the last one.
  • A batch row reads its own slot's table (qsa_prep#rows#mrope, with the row's offset in rinfo_'s fourth word, which is 0 now). On the slot-by-slot path, mrope_sync copies from the active slot's table.

Once it passes the same pairs on the Mac, I can open it as a PR if you want it.

Smallest steps or command that reproduce it

  1. 0.2.9 on a Mac, with setup's config plus "parallel": 2 and --vision.
  2. Send a picture request with temperature: 0 and max_tokens: 400 alone, and keep the text.
  3. Send the same request again, and a text request 1 s later. Compare the picture request's text with step 2.

Reproduction status

Reproduced locally

Strata version

0.2.9 from source (c62d5e3a), engine 0.1.55-metal

Graphics card, memory and system

Apple M5 Max · 128 GB · macOS 26.7.1

Model, size and settings

Swift 1.5 IQ3_S (SC117's abliterated build, the same file layout as UkisAI's), repacked by setup, Swift's projector · 262K context · --spec 2 with MTP · pictures on · "parallel": 2. Three synthetic test pictures: 6 shapes (640×400), a bar chart (640×400) and an invoice (800×300).

Logs

The server log shows 10 slot admissions (strata batch: slot N takes ...) and no error.

Originally created by @oceanio on GitHub (Nov 1, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/4908 ### Area Engine ### Desktop app, Terminal or source? Source (setup.sh or a build) ### What happened With `--vision` and `"parallel": 2` on the Mac engine, a picture request gives different text when another request decodes beside it than when it runs alone. The requests are greedy (temperature 0), so the text should be the same, and two text requests side by side do give the same text. Nothing in the log or the response says anything, and the engine keeps serving. I sent the requests through 0.2.9's own `serve/server.py`, with up to 400 tokens each. First each request ran alone, then in pairs, the second request starting 1 s after the first: | Pair | First request | Second request | |---|---|---| | text + text (T1, T2) | same as alone | same as alone | | picture + text (I1, T1) | **differs** | same as alone | | text + picture (T2, I2) | same as alone | **differs** | | picture + picture (I1, I2) | **differs** | **differs** | | picture + picture (I3, I1) | same as alone | same as alone (I3's 69 tokens were done before I1 started, so both ran alone) | The text matches until the second request joins, and differs from there on. I1 gives the same shape counts alone and beside T1, but its reasoning is worded differently from there: alone it says "First shape is a red circle. Second is a red circle.", and beside T1 it says "First shape: red circle. Second: red circle." I2's answer differs from its first sentence (both versions reached the 400-token limit before naming the bars). **Cause (from reading the code):** - A request that is alone runs on the solo path, where `mrope_sync` copies the process's M-RoPE table into `mrope_`, and its positions are right. - When a second request arrives, both decode in slot rows. Their `qsa_prep` is built with function constant 30 only (`metal/src/engine/window.cpp:953`, `qsa_prep#rows`), not with the M-RoPE constant 24, so every slot row rotates by its plain cell position. After a picture, the text sits at fewer M-RoPE positions than it has cells, so it is rotated as if it came later. A text request's table is the identity, which is why text requests are not affected. - The slot-by-slot path (`STRATA_METAL_BATCH_ROWS=0`) rotates with `mrope_sync`, which reads the process's table. The last request that was read in rebuilds that table, so a slot would read another request's positions there too. I did not run that path. **A possible fix**, which I have written but not yet run on the GPU: - Each slot keeps its own table (int32 [cells][3], 3.1 MB at 262K, allocated only with `--vision`). - `slot_copy` into a slot fills the slot's table from the admitting request's table: cells [0, upto) as they are, then one position per cell after the last one. - A batch row reads its own slot's table (`qsa_prep#rows#mrope`, with the row's offset in `rinfo_`'s fourth word, which is 0 now). On the slot-by-slot path, `mrope_sync` copies from the active slot's table. Once it passes the same pairs on the Mac, I can open it as a PR if you want it. ### Smallest steps or command that reproduce it 1. 0.2.9 on a Mac, with setup's config plus `"parallel": 2` and `--vision`. 2. Send a picture request with `temperature: 0` and `max_tokens: 400` alone, and keep the text. 3. Send the same request again, and a text request 1 s later. Compare the picture request's text with step 2. ### Reproduction status Reproduced locally ### Strata version 0.2.9 from source (`c62d5e3a`), engine 0.1.55-metal ### Graphics card, memory and system Apple M5 Max · 128 GB · macOS 26.7.1 ### Model, size and settings Swift 1.5 IQ3_S (SC117's abliterated build, the same file layout as UkisAI's), repacked by setup, Swift's projector · 262K context · `--spec 2` with MTP · pictures on · `"parallel": 2`. Three synthetic test pictures: 6 shapes (640×400), a bar chart (640×400) and an invoice (800×300). ### Logs The server log shows 10 slot admissions (`strata batch: slot N takes ...`) and no error.
Author
Owner

@oceanio commented on GitHub (Nov 1, 2026):

The fix is now #4961. On 0.2.9 plus only that change, with the same setup and requests as above, every request of every pair gives its text alone: 10 of 10 on the batch rows, and 10 of 10 slot by slot (STRATA_METAL_BATCH_ROWS=0). Requests alone give the same text as on 0.2.9.

Separately, while testing I found that on 0.2.9 two requests that decode side by side in the slots for more than 60 s are stopped by the serve watchdog, with or without pictures. #4960 fixes that.

<!-- gh-comment-id:6565328433 --> @oceanio commented on GitHub (Nov 1, 2026): The fix is now #4961. On 0.2.9 plus only that change, with the same setup and requests as above, every request of every pair gives its text alone: 10 of 10 on the batch rows, and 10 of 10 slot by slot (`STRATA_METAL_BATCH_ROWS=0`). Requests alone give the same text as on 0.2.9. Separately, while testing I found that on 0.2.9 two requests that decode side by side in the slots for more than 60 s are stopped by the serve watchdog, with or without pictures. #4960 fixes that.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#2252
No description provided.