[GH-ISSUE #2767] [Bug]: --rope-scaling and the other rope flags are resolved (for linear/yarn logged as active) on the Mac (Metal) engine but change no rotation #1109

Closed
opened 2026-11-04 01:48:34 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @oinani0721 on GitHub (Oct 16, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/2767

What happened

On the Metal engine, the rope flags that docs/DETAILS.md:1427-1430 lists (--rope-scaling, --rope-scale, --rope-freq-base, --rope-freq-scale, --yarn-*) and a model file's rope.scaling.* keys are resolved, and for linear and yarn the engine logs the scaling as active (strata generate: rope scaling yarn, factor 4 ..., src/program/generate.cpp:3002-3008). But no rotation on a Mac reads them:

  • rope_table_set does nothing on Metal (metal/src/engine/setup_host.cpp:151, "the window keeps its own table");
  • every RoPE rotation on Metal is in qsa_prep, which reads only the decode window's own cos/sin table (metal/kernels/qsa.metal:74);
  • Window::init builds that table without scaling, from the model file's rope.freq_base (metal/src/engine/window.cpp:468-475).

So, by the code, --rope-scaling yarn --rope-scale 4 gives the unscaled rotation, and a context past the trained 262,144 tokens runs with the stock angles.

Expected: the flags change the rotation on a Mac as they do on the PC.

On an Apple M5 Max (128 GB), main 296b59d's Metal build gave the same tokens, the same timing-free DONE fields and byte-identical first-window logits for 86 requests (a question, 64 tokens of a fixed text forced one per request, 20 prompts of 256 to 1,000 tokens and 128 tokens of a story), and byte-identical log-probability rows (the target token's and the top 64, STRATA_METAL_LOGPOS) at every position that the next one-token window continued (the 64 forced tokens and the story), with and without --rope-scaling yarn --rope-scale 4 --yarn-orig-ctx 262144 (the other rope flags were not run), with one-token decode windows (no MTP draft layer, no suffix drafts). On setup's default config its 6 requests gave identical tokens, DONE fields and first-window logits with and without --rope-scaling yarn --rope-scale 4 --yarn-orig-ctx 262144 too.

The model was Qwen3.8-Flash-Next-GSQ-RCO-abliterated-IQ3_S (two shards, revision eec4e10a of its Hugging Face repository), greedy, thinking off. I have a change that makes the window build its table with build_rope_table under the resolved scaling, with a CPU-only test, and will open it as a pull request that references this issue.

Strata version, GPU, OS

0.1.44.1-metal (main 296b59d) · Apple M5 Max, 128 GB · macOS 27.0.1

Engine log

strata generate: rope scaling yarn, factor 4 (freq_scale 0.25, base 1e+07, mscale 1.138629), --max-context 65536 against a trained context of 262144
Originally created by @oinani0721 on GitHub (Oct 16, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/2767 ### What happened On the Metal engine, the rope flags that docs/DETAILS.md:1427-1430 lists (`--rope-scaling`, `--rope-scale`, `--rope-freq-base`, `--rope-freq-scale`, `--yarn-*`) and a model file's `rope.scaling.*` keys are resolved, and for linear and yarn the engine logs the scaling as active (`strata generate: rope scaling yarn, factor 4 ...`, src/program/generate.cpp:3002-3008). But no rotation on a Mac reads them: - `rope_table_set` does nothing on Metal (metal/src/engine/setup_host.cpp:151, "the window keeps its own table"); - every RoPE rotation on Metal is in `qsa_prep`, which reads only the decode window's own cos/sin table (metal/kernels/qsa.metal:74); - `Window::init` builds that table without scaling, from the model file's `rope.freq_base` (metal/src/engine/window.cpp:468-475). So, by the code, `--rope-scaling yarn --rope-scale 4` gives the unscaled rotation, and a context past the trained 262,144 tokens runs with the stock angles. Expected: the flags change the rotation on a Mac as they do on the PC. On an Apple M5 Max (128 GB), main 296b59d's Metal build gave the same tokens, the same timing-free DONE fields and byte-identical first-window logits for 86 requests (a question, 64 tokens of a fixed text forced one per request, 20 prompts of 256 to 1,000 tokens and 128 tokens of a story), and byte-identical log-probability rows (the target token's and the top 64, `STRATA_METAL_LOGPOS`) at every position that the next one-token window continued (the 64 forced tokens and the story), with and without `--rope-scaling yarn --rope-scale 4 --yarn-orig-ctx 262144` (the other rope flags were not run), with one-token decode windows (no MTP draft layer, no suffix drafts). On setup's default config its 6 requests gave identical tokens, DONE fields and first-window logits with and without `--rope-scaling yarn --rope-scale 4 --yarn-orig-ctx 262144` too. The model was Qwen3.8-Flash-Next-GSQ-RCO-abliterated-IQ3_S (two shards, revision eec4e10a of its Hugging Face repository), greedy, thinking off. I have a change that makes the window build its table with `build_rope_table` under the resolved scaling, with a CPU-only test, and will open it as a pull request that references this issue. ### Strata version, GPU, OS 0.1.44.1-metal (main 296b59d) · Apple M5 Max, 128 GB · macOS 27.0.1 ### Engine log ``` strata generate: rope scaling yarn, factor 4 (freq_scale 0.25, base 1e+07, mscale 1.138629), --max-context 65536 against a trained context of 262144 ```
Author
Owner

@Niko1221 commented on GitHub (Oct 19, 2026):

Thanks for taking the time to report this.

We're resetting the tracker for 0.2.0-beta. There are more than 1,300 open issues and pull requests, too many for us to read properly, so we're closing everything that isn't being worked on right now. Closed here does not mean rejected.

To reopen it takes about two minutes:

  1. Re-test on 0.2.0-beta. It may already be fixed. Write down what you see.
  2. Start the title with its area: [Engine], [GUI], [TUI], [Benchmark], [Docs] or [Other].
  3. Fill in the parts of the issue form: what happened, the Strata version, your graphics card, memory and system.
  4. Comment /reopen. A check runs and either reopens the issue or lists what is still missing.

The rules are in CONTRIBUTING.md.

<!-- gh-comment-id:6271241218 --> @Niko1221 commented on GitHub (Oct 19, 2026): Thanks for taking the time to report this. We're resetting the tracker for 0.2.0-beta. There are more than 1,300 open issues and pull requests, too many for us to read properly, so we're closing everything that isn't being worked on right now. Closed here does not mean rejected. To reopen it takes about two minutes: 1. Re-test on 0.2.0-beta. It may already be fixed. Write down what you see. 2. Start the title with its area: [Engine], [GUI], [TUI], [Benchmark], [Docs] or [Other]. 3. Fill in the parts of the issue form: what happened, the Strata version, your graphics card, memory and system. 4. Comment `/reopen`. A check runs and either reopens the issue or lists what is still missing. The rules are in [CONTRIBUTING.md](https://github.com/Niko1221/Strata/blob/main/CONTRIBUTING.md).
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#1109
No description provided.