[PR #2957] [Engine] a WARNING when --max-context is past the model's trained context and no rope scaling is active #4360

Open
opened 2026-11-07 15:35:09 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/2957
Author: @sergqwer
Created: 10/17/2026
Status: 🔄 Open

Base: main ← Head: pr/ctx-warning


📝 Commits (1)

  • 469b176 engine: a WARNING when --max-context is past the model's trained context and no rope scaling is active

📊 Changes

1 file changed (+9 additions, -0 deletions)

View changed files

📝 src/program/generate.cpp (+9 -0)

📄 Description

Problem and result

A config written by hand with --max-context 524288 and no --rope-scaling starts without a word. Positions past 262,144 then rotate by angles the model never saw. Setup adds yarn above the trained context, but a hand-written config does not go through setup.

  • Before: such a start is silent.
  • After: one WARNING on stderr that names the fix. Nothing else changes; a context within the trained one, or any active rope scaling, prints nothing new.
strata generate: WARNING: --max-context 524288 is past the model's trained context of 262144 and no rope scaling is active: positions past it rotate by angles the model never saw, and it can lose track there. To extend the context: --rope-scaling yarn --rope-scale 2 (what setup writes above 262144)

None needed: a focused diagnostic, no behaviour change. It was #2957 before the 0.2.0-beta tracker reset, unchanged except for the rebase.

Approach

Where generate.cpp resolves the rope config to none, it compares --max-context with the trained context (the model's, or --yarn-orig-ctx) and prints the line once, before the experts load. The suggested --rope-scale is --max-context / trained context. 9 lines in src/program/generate.cpp, no new flag.

Validation

Revision: this branch, one commit 469b1760 on main e88ee39d (v0.2.0-beta + 12 commits), against a build of main e88ee39d. RTX 5090, Ryzen 9 9950X3D, 128 GB, Windows 11; MSVC 2022 17.14, CUDA 13.3, release configure (-DSTRATA_PORTABLE=ON, 75-real;86-real;89-real;120-real, ggml at the pinned 3cf03257). Model: the NVFP4 GPTQ pack (Maximilian228/Qwen3.8-Flash-Next-NVFP4-GPTQ-Strata, upstream setup's --family nvfp4 --model NVFP4 files). Each start is strata --serve with setup's model files plus --expert-cache 3000 --prefill auto --spec 6 --spec-min-p 0.7 --kv int8 --gpu 0 --pcie-frac 0 --adapt-every 1000000, env STRATA_PREFILL_CPU_SHARE=0 STRATA_PCIE_BALANCE=0 STRATA_IQ_MT_MIN=1.

Passed:

start main e88ee39d this branch
--max-context 524288, no --rope-scaling starts, no WARNING starts, the one WARNING above (before the experts load)
--max-context 524288 --rope-scaling yarn --rope-scale 2 - no WARNING; the existing rope scaling yarn, factor 2 (freq_scale 0.5, base 1e+07, mscale 1.069315) ... line
--max-context 262144 no WARNING no WARNING
  • Identity at the default 262144 (STRATA_DUMP_FIRST_LOGITS, a 2,100-token and a 32,037-token prompt, 32 greedy tokens each, both stop at the end of turn): first-token logits and tokens byte-identical to main's. 2K 1e9c612c2e6c7a32..., 4 tokens; 32K f5b2872c7ac30b17..., 20 tokens.

Failed: none observed.

Not run:

  • HIP and Metal builds: both compile this generate.cpp; no ROCm or Mac here. The change is a plain fprintf.
  • SYCL: its own sycl/src/program/generate.cpp is not changed, so a SYCL start stays silent.

Limits

A warning only: the start goes on as before. It does not look at a context the client asks for per request, only at --max-context.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/2957 **Author:** [@sergqwer](https://github.com/sergqwer) **Created:** 10/17/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `pr/ctx-warning` --- ### 📝 Commits (1) - [`469b176`](https://github.com/Niko1221/Strata/commit/469b17603acc78bfc50cc4edd63623d3498b375c) engine: a WARNING when --max-context is past the model's trained context and no rope scaling is active ### 📊 Changes **1 file changed** (+9 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `src/program/generate.cpp` (+9 -0) </details> ### 📄 Description ## Problem and result A config written by hand with `--max-context 524288` and no `--rope-scaling` starts without a word. Positions past 262,144 then rotate by angles the model never saw. Setup adds yarn above the trained context, but a hand-written config does not go through setup. - Before: such a start is silent. - After: one WARNING on stderr that names the fix. Nothing else changes; a context within the trained one, or any active rope scaling, prints nothing new. ``` strata generate: WARNING: --max-context 524288 is past the model's trained context of 262144 and no rope scaling is active: positions past it rotate by angles the model never saw, and it can lose track there. To extend the context: --rope-scaling yarn --rope-scale 2 (what setup writes above 262144) ``` ## Related discussion None needed: a focused diagnostic, no behaviour change. It was #2957 before the 0.2.0-beta tracker reset, unchanged except for the rebase. ## Approach Where `generate.cpp` resolves the rope config to `none`, it compares `--max-context` with the trained context (the model's, or `--yarn-orig-ctx`) and prints the line once, before the experts load. The suggested `--rope-scale` is `--max-context` / trained context. 9 lines in `src/program/generate.cpp`, no new flag. ## Validation Revision: this branch, one commit 469b1760 on `main` **e88ee39d** (v0.2.0-beta + 12 commits), against a build of `main` e88ee39d. RTX 5090, Ryzen 9 9950X3D, 128 GB, Windows 11; MSVC 2022 17.14, CUDA 13.3, release configure (`-DSTRATA_PORTABLE=ON`, `75-real;86-real;89-real;120-real`, ggml at the pinned 3cf03257). Model: the NVFP4 GPTQ pack (`Maximilian228/Qwen3.8-Flash-Next-NVFP4-GPTQ-Strata`, upstream setup's `--family nvfp4 --model NVFP4` files). Each start is `strata --serve` with setup's model files plus `--expert-cache 3000 --prefill auto --spec 6 --spec-min-p 0.7 --kv int8 --gpu 0 --pcie-frac 0 --adapt-every 1000000`, env `STRATA_PREFILL_CPU_SHARE=0 STRATA_PCIE_BALANCE=0 STRATA_IQ_MT_MIN=1`. **Passed:** | start | `main` e88ee39d | this branch | | --- | --- | --- | | `--max-context 524288`, no `--rope-scaling` | starts, no WARNING | starts, the one WARNING above (before the experts load) | | `--max-context 524288 --rope-scaling yarn --rope-scale 2` | - | no WARNING; the existing `rope scaling yarn, factor 2 (freq_scale 0.5, base 1e+07, mscale 1.069315) ...` line | | `--max-context 262144` | no WARNING | no WARNING | - Identity at the default 262144 (`STRATA_DUMP_FIRST_LOGITS`, a 2,100-token and a 32,037-token prompt, 32 greedy tokens each, both stop at the end of turn): first-token logits and tokens byte-identical to `main`'s. 2K `1e9c612c2e6c7a32...`, 4 tokens; 32K `f5b2872c7ac30b17...`, 20 tokens. **Failed:** none observed. **Not run:** - HIP and Metal builds: both compile this `generate.cpp`; no ROCm or Mac here. The change is a plain `fprintf`. - SYCL: its own `sycl/src/program/generate.cpp` is not changed, so a SYCL start stays silent. ## Limits A warning only: the start goes on as before. It does not look at a context the client asks for per request, only at `--max-context`. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
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#4360
No description provided.