Skip to content

Qwen3.8-Flash-Next on any consumer hardware: one-click install for Windows / Linux. Strata inference engine, OpenAI/Anthropic API on localhost, optional image input.

C++

docs: rope scaling is experimental and opt-in; the measured perplexity at 293K

Niko12214240629dba50
diff --git a/README.md b/README.md
index 5df47299b..32490cd8e 100644
--- a/README.md
+++ b/README.md
@@ -103,7 +103,7 @@ App). Everything else - Python, the engine, the model - is set up for you.
3. Answer a few questions - or just press Enter each time for the recommended choice:
- **Which model and size?** The original or Swift 1.5, and Q2_0, IQ2_XS, IQ3_XXS or IQ3_S - see [above](#which-model-should-i-pick)
- **How much context?** How much text it can keep in mind at once (it suggests one for your card). 384K and
- 512K extend the model past its trained 262K by rope scaling - the setup turns it on itself (yarn and a
+ 512K (experimental) extend the model past its trained 262K by rope scaling - the setup turns it on itself (yarn and a
covering factor; `--rope-scaling`/`--rope-scale` override) ([details](docs/DETAILS.md))
- **Images?** Whether it should also read pictures
- **Experimental speed projection?** Off unless you say yes - [read what it does](docs/DETAILS.md#experimental-speed-projection-experimental-off-by-default) first
diff --git a/bench/results/2026-09-28-rope-scaling/README.md b/bench/results/2026-09-28-rope-scaling/README.md
index e1e2e4770..1624f43e0 100644
--- a/bench/results/2026-09-28-rope-scaling/README.md
+++ b/bench/results/2026-09-28-rope-scaling/README.md
@@ -1,6 +1,6 @@
# Rope scaling: needle recall past the trained 262K
-The feature (engine 0.1.18): `--rope-scaling none|linear|yarn` extends the context past the model's
+The feature (PR #84, experimental): `--rope-scaling none|linear|yarn` extends the context past the model's
trained 262,144 positions by rescaling the rotary angles - llama.cpp's types, ggml's `rope_yarn`
arithmetic, one process config applied at the cos/sin table (default path) and as kernel constants
(`--native-rope`, the native indexer, prefill). The three tables here are the first end-to-end check
diff --git a/docs/DETAILS.md b/docs/DETAILS.md
index 7f5a8184b..953810a64 100644
--- a/docs/DETAILS.md
+++ b/docs/DETAILS.md
@@ -428,17 +428,27 @@ it needs, prefer read-only tools, and don't add servers you don't trust. The too
page itself (a request with another site's Origin or without a JSON content type is refused); if Strata is reachable
from other devices, set an API key.
-**Context extension (rope scaling, engine 0.1.18).** The model trains 262,144 positions of rotary base
-1e7; the context past that stays coherent by rescaling the rotation angles, with llama.cpp's types and
-flag names. `linear` is Position Interpolation (every angle shrunk by the factor); `yarn` keeps the
-high-frequency angles and interpolates the low-frequency ones, with the magnitude correction that keeps
-the attention temperature where training put it. Scaled contexts also need proportionally more VRAM/RAM
-for the KV cache and the rope tables (~13 KB and ~0.26 KB per token).
+**Context extension past 262K (rope scaling, EXPERIMENTAL, off unless you pick it).** The model was trained on
+262,144 positions (rotary base 1e7). Rope scaling rescales the rotation angles so that longer contexts stay usable,
+with llama.cpp's types and flag names. `linear` is Position Interpolation: every angle is shrunk by the factor.
+`yarn` keeps the high-frequency angles, interpolates the low-frequency ones, and adds the magnitude correction
+that keeps the attention temperature where training put it. **Without the flags nothing changes:** an unscaled
+run computes exactly what it did before the feature existed, bit for bit. Scaled contexts need proportionally
+more VRAM/RAM for the KV cache and the rope tables (~13 KB and ~0.26 KB per token).
+
+What was measured (contributors' runs, RTX 5080 + IQ3_S, native path, in PR #84): per-position perplexity on the
+same tokens, with only the scaling flag changed. At 293K tokens (1.12x the trained length), `yarn` with factor 2
+lowered the NLL by 0.18 nats against both `none` and `linear` 2 (2.04 vs 2.22 / 2.22). That is 3-4x the path noise
+measured at the same length. `linear` 2 was indistinguishable from `none`. At 2.7K and 32K no arm separated from the
+noise. Needle tests do not tell the arms apart: the unscaled model also finds a needle at 413K. Long real-document
+Q&A worked with `yarn` 2 at 421K and `yarn` 4 at 714K (8/8 each), and a 1M-token `yarn` 4 run read end to end.
+Taken together, use **yarn**. It is still experimental: the numbers come from one machine and one quant.
- setup: `START-HERE.bat --setup --context 393216` asks nothing extra - it picks the method (yarn; one
question when run interactively) and derives the factor from the final context for you (final context /
262,144, at least 1: 1.5 at 393K, 2 at 512K, 1 inside the trained range; `--rope-scaling`/`--rope-scale`
- override, an explicit factor is kept as given). An explicit `--rope-scaling none` for a context past
+ override; an explicit `--rope-scale` is kept as given even when it is too small for the context actually
+ served, so check it if you set one). An explicit `--rope-scaling none` for a context past
262,144 is refused: the setup will not configure a run with the stock angles past the trained range. If
the RAM check reduces a chosen 384K/512K back inside the trained range, an omitted method adds no
scaling, and an explicitly chosen one stays at factor 1 - the trained angles, no expansion (not a
@@ -450,10 +460,10 @@ for the KV cache and the rope tables (~13 KB and ~0.26 KB per token).
The scaling is fixed for the whole run - the engine stores keys in its cache after rotating them, so one
cache must never mix two scalings, and there is no per-request form. Within the trained 262,144 a scaled
-run is a different (very slightly perturbed) model: `yarn`'s magnitude correction applies everywhere, not
-only past the trained end. Needle recall past the trained end passes (262k and 512k prompt probes at
-linear 2 and yarn 2, mid-depth, `tools/needle_bench.py`); pictures read the same scaled table (their
-(t, h, w) positions feed it), which is expected to compose but unmeasured - the recall runs are text.
+run is a slightly different model: the rescaled angles, and `yarn`'s magnitude correction, apply at every
+position, not only past the trained end. That is why the setup turns scaling on only for a context past
+262,144. Pictures read the same scaled table (their (t, h, w) positions feed it). That should work, but it is
+unmeasured: all the runs above are text.
---
@@ -584,7 +594,7 @@ the document, +0.4% on the chat. Details: `bench/results/2026-09-27-esp/`.
| `the engine stopped unexpectedly (exit code ...)` | The engine process ended mid-answer - usually out of RAM (Linux ends the biggest program: `sudo dmesg \| grep -i -E 'killed process\|out of memory'`). The next request starts it again by itself. If it repeats: close other programs or pick a smaller size. The server also warns at start when the model's experts leave less than ~6 GB of RAM for everything else. |
| Slow output, disk light busy | Not enough free RAM: close other programs, or choose Q2_0 / IQ2_XS. |
| `prompt ... exceeds the context` | The request is longer than the context you chose: run setup again with a bigger `--context`. |
-| `the setup refuses --rope-scaling none for a past-trained context` | A context past the trained 262,144 needs the rotary angles rescaled (engine 0.1.18+), and the setup will not configure one with the stock angles there. Let it pick (`START-HERE.bat --setup --context 393216` adds yarn and a covering factor), or pass `--rope-scaling linear` or `yarn` yourself. |
+| `the setup refuses --rope-scaling none for a past-trained context` | A context past the trained 262,144 needs the rotary angles rescaled (experimental rope scaling), and the setup will not configure one with the stock angles there. Let it pick (`START-HERE.bat --setup --context 393216` adds yarn and a covering factor), or pass `--rope-scaling linear` or `yarn` yourself. |
| Slower than the tables | The monitor plugged into the GPU and other GPU programs take VRAM from the expert cache; RAM running below its rated speed (enable EXPO/XMP in the BIOS) slows the CPU half. |
| `this server was started without the vision encoder` | The model was set up for text only: run setup again with `--vision gpu`. |
| A picture is refused or `cannot read the image` | The file is not a picture Pillow can open (JPEG, PNG, WebP, GIF, BMP, TIFF, AVIF work). |
diff --git a/setup.py b/setup.py
index 0293d6b20..b4458e392 100644
--- a/setup.py
+++ b/setup.py
@@ -1904,7 +1904,7 @@ def main() -> int:
say(" Longer needs more VRAM for it, so fewer experts fit on the GPU:")
for i, c in enumerate(CONTEXTS, 1):
note = (" (recommended for your GPU)" if c == rec_ctx else "") + \
- (" (setup adds rope scaling)" if c > 262144 else "")
+ (" (experimental: setup adds rope scaling)" if c > 262144 else "")
say(f" {i}) {c // 1024}K tokens{note}")
ctx = CONTEXTS[int(ask("Context?", [str(i) for i in range(1, len(CONTEXTS) + 1)],
str(CONTEXTS.index(rec_ctx) + 1), a.yes)) - 1]