mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #84] [CLOSED] EXPERIMENTAL Rope scaling: contexts past the trained 262K (none / linear / YaRN) #2445
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#2445
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/84
Author: @j-luwierski
Created: 9/28/2026
Status: ❌ Closed
Base:
main← Head:feat/rope-scaling📝 Commits (10+)
df08bd0kernels: rope scaling config and the scaled cos/sin table (none/linear/YaRN)18ea6a9rope: thread scaling through the native, indexer and prefill rotation sites0bc73eaengine: --rope-scaling/--rope-scale/--yarn-* flags; rope keys as GGUF defaultsd814039setup: --rope-scaling/--rope-scale; contexts past 262144 require scaling551acaedocs: context extension (rope scaling)00f030cgenerate: an explicit --rope-scaling none or --rope-scale 1 overrides the GGUF rope keysf8777f9bench: rope-scaling needles past the trained 262K (linear 2, yarn 2)7d581d8indexer: the batched append takes the one rope config, with a parity test193408bsetup: the documented automatic rope configuration actually happens nowb167abdsetup: a free-form --context past the menu got a raw StopIteration📊 Changes
32 files changed (+1871 additions, -84 deletions)
View changed files
📝
README.md(+3 -1)➕
bench/results/2026-09-28-rope-scaling/README.md(+49 -0)➕
bench/results/2026-09-28-rope-scaling/config-A-none-262144.json(+38 -0)➕
bench/results/2026-09-28-rope-scaling/config-B-linear2.json(+42 -0)➕
bench/results/2026-09-28-rope-scaling/config-C-yarn2.json(+42 -0)➕
bench/results/2026-09-28-rope-scaling/kv-sweep-tgs.json(+121 -0)➕
bench/results/2026-09-28-rope-scaling/needle-A-none.json(+29 -0)➕
bench/results/2026-09-28-rope-scaling/needle-B-linear2-512k.json(+11 -0)➕
bench/results/2026-09-28-rope-scaling/needle-B-linear2.json(+16 -0)➕
bench/results/2026-09-28-rope-scaling/needle-C-yarn2-rebased.json(+11 -0)➕
bench/results/2026-09-28-rope-scaling/needle-C-yarn2.json(+20 -0)📝
docs/DETAILS.md(+49 -0)📝
include/strata/kernels/native_qsa_indexer.hpp(+6 -2)📝
include/strata/kernels/native_rope.hpp(+11 -5)📝
include/strata/kernels/qsa.hpp(+4 -1)📝
include/strata/kernels/rope.hpp(+14 -0)➕
include/strata/kernels/rope_scaling.hpp(+209 -0)📝
include/strata/prefill/kernels.hpp(+5 -2)📝
setup.py(+97 -8)📝
src/core/layer.cpp(+4 -3)...and 12 more files
📄 Description
What
--rope-scaling none|linear|yarn- llama.cpp's types and flag names - extends the context past the model's trained 262,144 positions by rescaling the rotary angles: Position Interpolation forlinear, ggml'srope_yarn(the corr_dims ramp and the mscale magnitude correction) foryarn. Engine 0.1.21; setup grows--rope-scaling/--rope-scaleand 383K/512K context choices that pick the factor themselves.How it fits the engine
build_rope_table), sorope_neox_applyand the indexer's pooled-key rotation cannot tell a scaled table from an unscaled one.--native-rope, the native indexer, prefill'srope) take the resolved constants (freq_scale,corr_dims,ext_factor,attn_factor) as kernel arguments. They are process constants set once beforesession_init, so CUDA-graph capture bakes them correctly; positions keep riding device memory (st.pos_dev).rope_scaled_angle), transcribed line-for-line from the vendored ggml with the MIT headers kept, serves all three analytic sites; oneRopeScalingstruct with arope_scaling_set()startup setter follows the house pattern (native_rope_set_enabled,mrope_table_set).qwen4exp.rope.*keys over the struct defaults (the artifact ships no rope keys today, so that channel is a no-op for now). The scaling is fixed per process - K sits in the cache post-RoPE, so one cache must never mix two scalings; there is no per-request form.rope_paritygrows to 13 checks; docs (DETAILS.md) gain the "Context extension" section and a troubleshooting row.Validation
noneis bit-identical to the old table builder; linear(4) is bit-exact against a float64 reference and row-equal tononeat p/4; YaRN against a float64 transcription of ggml's spec; structural checks a tolerance cannot fake (cos_tab[0] == mscale; first pair extrapolates, last interpolates); an observability assertion; and native-vs-table agreement on the same input - the fixture that caught a real double-mscale bug in a first draft.serve.test_serverstay green.tools/needle_bench.py, depth 50%, temperature 0, RTX 4070 Ti SUPER + IQ3_XXS): 8/8 probes found - baseline (none) at 1k/32k/128K, then linear 2x and yarn 2x at 262k and 512k probe lengths; the 512k probes are 527k prompt tokens, 2.01x the trained 262,144, recalled at mid-depth (a 262k yarn probe re-ran green after the rebase onto 0.1.20). The raw runs stay on the development machine, out of this tree.Notes
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.