diff --git a/bench/results/2026-10-09-rope-yarn-long-context/README.md b/bench/results/2026-10-09-rope-yarn-long-context/README.md new file mode 100644 index 00000000..1615391e --- /dev/null +++ b/bench/results/2026-10-09-rope-yarn-long-context/README.md @@ -0,0 +1,172 @@ +# Existing RoPE and YaRN at 512K and 1M + +![Three-code recall and fresh prefill time](overview.png) + +This report uses **Strata's existing YaRN implementation on unmodified main**. +It adds a reproducible probe, per-run measurements, and a figure; no inference +code, cache converter, or serving default changes are included. + +## What this tells us about choosing RoPE settings + +- **Within this artifact's declared 262,144-token context:** retain the normal + model/setup defaults. This long-context probe does not establish that enabling + YaRN permanently improves short requests. +- **Beyond the declared context:** Strata setup already selects experimental + YaRN and a covering scale. Continue using that documented behavior. Ordinary + RoPE's successful 512K probe is not evidence of a safe 512K cutoff. +- **At 1M:** compare the exact answers below. This is one three-fact retrieval + prompt, not a general 1M quality certification or a measurement of where to + switch scaling. No automatic quality acceptance threshold is used. + +The model's context metadata is an artifact declaration, not independent proof +of its training history. YaRN changes positional behavior throughout the +conversation, including shorter positions. A process uses one RoPE configuration. + +## Set up YaRN simply + +YaRN is already in main; this PR is not required to enable it. For an existing +Strata installation, rerun setup with the desired total context capacity. + +Linux: + +```sh +./setup.sh --setup --context 1048576 --rope-scaling yarn --rope-scale 4 +``` + +Windows: + +```bat +START-HERE.bat --setup --context 1048576 --rope-scaling yarn --rope-scale 4 +``` + +Stop the current server before rerunning setup. Select the model you want to +configure; `--setup` saves the new settings and starts it. On later launches, +run `./setup.sh` on Linux or `START-HERE.bat` on Windows to use the saved settings, +then send requests normally. For 512K, +use `--context 524288 --rope-scaling yarn --rope-scale 2`. That is the existing +setup policy; **YaRN 2x at 512K was not measured in this report**. +Setup chooses other options for your hardware, so these commands do not promise +the FP16 benchmark's memory use or speed on another GPU. Check the resolved +context and RoPE settings in the startup log. + +When launching the native engine directly, add these to your existing model +arguments (replace any conflicting context/RoPE flags): + +```sh +--max-context 1048576 --rope-scaling yarn --rope-scale 4 --yarn-orig-ctx 262144 +``` + +The context capacity includes the prompt and generated reply: leave room for +output. The benchmark used a slightly larger allocation of 1,048,832 to test +an actual 1,048,576-token input plus its reply and engine headroom. + +Example request to a local server after setup (change the port/key if configured): + +```sh +curl http://127.0.0.1:8080/v1/chat/completions \ + -H 'Content-Type: application/json' \ + -H "Authorization: Bearer $STRATA_API_KEY" \ + -d '{"model":"strata","messages":[{"role":"user","content":"Write a Python function that returns the maximum of a nonempty list."}],"max_tokens":128,"temperature":0,"reasoning_effort":"none"}' +``` + +**Restart with the selected settings before starting the conversation.** Do not +restore an ordinary-RoPE KV session into a differently configured YaRN engine. +Replay the canonical conversation under YaRN to build matching state. This +report does not implement an in-place switch or validate approximate cache +migration followed by continuation to 1M. + +See [Strata's existing context-extension documentation](../../../docs/DETAILS.md) +and the earlier [1M YaRN measurement, #348](https://github.com/Niko1221/Strata/issues/348). + +## Workload and measurement boundaries + +The user message contains three codes, separated by repetitions of ` apple` +and ` orange`. The final request is: “Return all three codes in order separated +by |. Nothing else.” The exact tokenizer/template renders the prompt to either +524,288 or 1,048,576 tokens. [probe.py](probe.py) constructs those IDs and records +their SHA-256; the two 1M conditions must have identical input hashes. + +Expected answer: + +```text +CEDAR-731|MARBLE-482|QUARTZ-956 +``` + +Each condition starts a separate resident engine with no cached-prefix reuse. +The timed request starts after model loading. Prefill and decode rates come +from the engine's timing line; TTFT and total request time are also retained. +The output cap is 64 tokens; report the actual generated count. RAM is the +engine's Linux RSS high-water mark (including mapped/shared pages), and VRAM is +device-wide usage sampled approximately once per second. These are not +allocation-accounting totals. There are no other inference jobs on the GPU. + +This is **one run per condition**, three expected associations, repeated filler, +and a short reply. No confidence intervals, percentile latency claims, broad +coding-quality claims, or safe switching boundary can be inferred. The names +and numbers being present but incorrectly paired is recorded as an association +error, not hidden by a substring-presence score. + +## Reproduce + +Use upstream main at `fb58e0dbc8399662c0e47c76578c6e878b14f6cf` and an existing +ISTA IQ3_XXS configuration. Build on the benchmark GPU: + +```sh +cmake -S . -B build -DSTRATA_ENABLE_CUDA=ON \ + -DCMAKE_CUDA_ARCHITECTURES=120 \ + -DCMAKE_CUDA_COMPILER=/usr/local/cuda/bin/nvcc +cmake --build build -j8 --target strata + +python bench/results/2026-10-09-rope-yarn-long-context/probe.py \ + --config strata.json --exe build/strata --tokens 1048576 \ + --rope yarn --output /tmp/strata-yarn-1m +``` + +For the ordinary-RoPE comparison, change only `--rope yarn` to `--rope none` +and choose a new output directory. For its 512K condition, also change +`--tokens` to `524288`. These are deliberate native-engine extrapolation probes; +setup itself refuses ordinary RoPE beyond the declared context. + +The probe fixes FP16 KV, prefill 8192, MTP off, suffix drafting off, speculation +width 2, parked-conversation RAM cache off, CPU prefill share zero, deterministic +greedy decoding, and allocation capacity 1,048,832. Model/pack paths and the +expert profile come from the supplied configuration. It needs Strata's existing +Python environment; no separate evaluation service is used. + +Run `python plot.py` in this directory to regenerate PNG and SVG figures from +`results.json` (requires matplotlib). Model weights, token caches, private +profiles, and credentials are not included. + + + +## Measured results on untouched main + +| Configuration | Actual input | Correct pairs | Fresh prefill | Prefill tok/s | Decode tok/s | Generated | +|---|---:|---:|---:|---:|---:|---:| +| Ordinary RoPE | 524,288 | 3/3 | 95.7 s | 5,479.2 | 103.6 | 22 | +| Ordinary RoPE | 1,048,576 | 0/3 | 235.5 s | 4,452.1 | 82.4 | 22 | +| YaRN 4x from token zero | 1,048,576 | 3/3 | 232.8 s | 4,504.8 | 82.7 | 22 | + +All runs: RTX PRO 6000 Blackwell 96 GB, Ryzen 9 7950X, 124 GiB usable RAM, +Ubuntu 24.04.5, NVIDIA driver 595.91.07, CUDA 13.2.86, GPU power limit 400 W. +Main commit: `fb58e0dbc8399662c0e47c76578c6e878b14f6cf` (engine 0.1.41). +The model is ISTA-DASLab IQ3_XXS; its download revision was not recorded. +The expert profile matches upstream `data/expert-profile.bin` by SHA-256. + +Peak sampled GPU usage: 70.8–70.8 GiB; engine RSS high-water mark: 43.3–43.4 GiB. + +The two 1M input hashes match. All three use the same executable hash. +The 1M ordinary-RoPE answer was: + +```text +CEDAR-482|MARBLE-956|QUARTZ-731 +``` + +The 1M YaRN answer was: + +```text +CEDAR-731|MARBLE-482|QUARTZ-956 +``` + +See [results.json](results.json) for input/executable/profile hashes, launch arguments, +per-run TTFT/total time, resource observations, and all actual answers. No private development-build measurements are mixed into this table. diff --git a/bench/results/2026-10-09-rope-yarn-long-context/overview.png b/bench/results/2026-10-09-rope-yarn-long-context/overview.png new file mode 100644 index 00000000..0dd72bea Binary files /dev/null and b/bench/results/2026-10-09-rope-yarn-long-context/overview.png differ diff --git a/bench/results/2026-10-09-rope-yarn-long-context/overview.svg b/bench/results/2026-10-09-rope-yarn-long-context/overview.svg new file mode 100644 index 00000000..cc95931a --- /dev/null +++ b/bench/results/2026-10-09-rope-yarn-long-context/overview.svg @@ -0,0 +1,4159 @@ + + + + + + + + 2026-10-09T04:52:50.313823 + image/svg+xml + + + Matplotlib v3.11.2, https://matplotlib.org/ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bench/results/2026-10-09-rope-yarn-long-context/plot.py b/bench/results/2026-10-09-rope-yarn-long-context/plot.py new file mode 100644 index 00000000..3cff6445 --- /dev/null +++ b/bench/results/2026-10-09-rope-yarn-long-context/plot.py @@ -0,0 +1,51 @@ +"""Regenerate the figure from results.json: python plot.py (requires matplotlib).""" +import json +from pathlib import Path +import matplotlib +matplotlib.use('Agg') +import matplotlib.pyplot as plt +from matplotlib.patches import FancyBboxPatch + +HERE=Path(__file__).resolve().parent +data=json.loads((HERE/'results.json').read_text()) +rows=data['runs'] +BG='#f5f7fb';INK='#14243a';MUTED='#516379';GRID='#dbe2ec' +colors=['#426b9f' if r['rope']=='none' else '#008879' for r in rows] +labels=[('Ordinary RoPE' if r['rope']=='none' else 'YaRN 4x')+' / '+('512K' if r['input_tokens']==524288 else '1M') for r in rows] +plt.rcParams.update({'font.family':'DejaVu Sans','font.size':12,'text.color':INK,'axes.labelcolor':MUTED,'xtick.color':MUTED,'ytick.color':INK}) +fig=plt.figure(figsize=(14,9),facecolor=BG) +fig.text(.055,.945,'Ordinary RoPE vs YaRN at long context',fontsize=25,weight='bold') +fig.text(.055,.900,'Existing Strata on untouched main | ISTA IQ3_XXS | FP16 KV | RTX PRO 6000 Blackwell',fontsize=12,color=MUTED) +left=fig.add_axes([.24,.52,.24,.29],facecolor=BG) +right=fig.add_axes([.64,.52,.30,.29],facecolor=BG) +for ax in (left,right): + for spine in ax.spines.values():spine.set_visible(False) + ax.set_ylim(2.6,-.6);ax.tick_params(axis='both',length=0) +left.set_title('Correct code associations',loc='left',pad=24,fontsize=14,weight='bold') +left.set_yticks(range(3),labels);left.tick_params(axis='y',pad=15);left.set_xticks([]);left.set_xlim(0,3.65) +for i,r in enumerate(rows): + correct=r['correct_code_pairs'] + for j in range(3): + left.add_patch(FancyBboxPatch((j+.04,i-.24),.87,.48,boxstyle='round,pad=0.015,rounding_size=.05', + linewidth=0,facecolor=colors[i] if ja.capacity:p.error('leave 256 tokens of capacity for output/internal headroom') + a.output.mkdir(parents=True,exist_ok=False) + cfg=json.loads(a.config.read_text());tp=Path(cfg['tokenizer']) + vocab=json.loads((tp/'vocab.json').read_text());v=[None]*len(vocab) + for text,i in vocab.items():v[i]=text + tok=ST.Tokenizer(v,(tp/'merges.txt').read_text().split('\n'),json.loads((tp/'token_type.json').read_text())) + template=ChatTemplate(tp/'chat_template.jinja') + def prompt(n): + content=('The first code is CEDAR-731.\n'+' apple'*(n//2)+ + '\nThe middle code is MARBLE-482.\n'+' orange'*(n-n//2)+ + '\nThe last code is QUARTZ-956.\nReturn all three codes in order separated by |. Nothing else.') + return tok.encode(template.render([{'role':'user','content':content}],tools=None,enable_thinking=False),parse_special=True) + lo,hi=0,a.tokens + while lo',''),reused_tokens=engine.reused) + result['correct_code_pairs']=sum(x==y for x,y in zip(result['expected'].split('|'),result['answer'].split('|'))) + result['complete']=True + except Exception as exc: + result.update(complete=False,error=repr(exc)) + raise + finally: + if engine:engine.close() + stop.set();worker.join(timeout=5) + result['peak_gpu_gib']=max((s.get('gpu_mib',0) for s in samples),default=0)/1024 + result['peak_engine_rss_gib']=max((s.get('VmHWM_kib',0) for s in samples),default=0)/1048576 + log=a.output/'engine.log' + if log.exists(): + matches=re.findall(r'prompt (\d+) tokens = (\d+) reused \+ (\d+) read in ([\d.]+) ms \(([\d.]+) tok/s\), (\d+) generated in ([\d.]+) ms \(([\d.]+) tok/s\)',log.read_text(errors='replace')) + if matches: + m=matches[-1];result.update(native_prompt_tokens=int(m[0]),native_reused_tokens=int(m[1]),prefill_s=float(m[3])/1000,prefill_tps=float(m[4]),decode_tps=float(m[7])) + (a.output/'resources.json').write_text(json.dumps(samples,indent=2)) + (a.output/'results.json').write_text(json.dumps(result,indent=2)) + print(json.dumps({k:v for k,v in result.items() if k!='argv'}),flush=True) + + +if __name__=='__main__':main() diff --git a/bench/results/2026-10-09-rope-yarn-long-context/results.json b/bench/results/2026-10-09-rope-yarn-long-context/results.json new file mode 100644 index 00000000..04f81cbb --- /dev/null +++ b/bench/results/2026-10-09-rope-yarn-long-context/results.json @@ -0,0 +1,217 @@ +{ + "source_commit": "fb58e0dbc8399662c0e47c76578c6e878b14f6cf", + "engine": "unmodified upstream main, 0.1.41", + "hardware": { + "gpu": "NVIDIA RTX PRO 6000 Blackwell Workstation Edition (96 GB)", + "cpu": "AMD Ryzen 9 7950X", + "system_ram": "124 GiB usable reported by Linux", + "gpu_power_limit_w": 400 + }, + "software": { + "os": "Ubuntu 24.04.5 LTS", + "cuda": "13.2.86", + "driver": "595.91.07", + "cuda_arch": 120 + }, + "model": { + "repository": "ISTA-DASLab/Qwen3.8-Flash-Next-GSQ-RCO-GGUF", + "quantization": "IQ3_XXS", + "repository_revision": "not recorded", + "files": [ + "Qwen3.8-Flash-Next-GSQ-RCO-IQ3_XXS-00001-of-00002.gguf", + "Qwen3.8-Flash-Next-GSQ-RCO-IQ3_XXS-00002-of-00002.gguf" + ], + "declared_context": 262144, + "rope_base": 10000000, + "rotary_dimensions": 64, + "expert_profile_sha256": "8f59b4aa8873209dff11c11e37bcda9529a1335b724a1afeea37bf6388975baf", + "expert_profile": "upstream data/expert-profile.bin" + }, + "settings": { + "kv": "fp16", + "prefill": 8192, + "mtp": false, + "suffix_draft": 0, + "spec": 2, + "conversation_cache_mib": 0, + "temperature": 0, + "env": { + "STRATA_PREFILL_CPU_SHARE": "0" + }, + "vram_reserve_mib": 1024, + "capacity": 1048832 + }, + "expected": "CEDAR-731|MARBLE-482|QUARTZ-956", + "runs": [ + { + "input_tokens": 524288, + "input_sha256": "0a562e987c9a63bc5ab55dd0712a5f0264178163eebecdfe10179a4723d8d318", + "rope": "none", + "capacity": 1048832, + "argv": [ + "--pack", + "$PACK", + "--native", + "$GGUF_SHARD_1", + "--ple-gguf", + "$GGUF_SHARD_2", + "--expert-profile", + "$EXPERT_PROFILE", + "--expert-cache", + "auto", + "--stats", + "--vram-reserve-mib", + "1024", + "--kv", + "fp16", + "--spec", + "2", + "--suffix-draft", + "0", + "--conversation-cache-mib", + "0", + "--prefill", + "8192", + "--max-context", + "1048832", + "--rope-scaling", + "none" + ], + "expected": "CEDAR-731|MARBLE-482|QUARTZ-956", + "executable_sha256": "6d1ff96c482bec4ac3c5d277b61554ca4f2db29e285952f9928df669a950ae1a", + "samples_per_condition": 1, + "startup_s": 11.458124796045013, + "ttft_s": 95.77448770601768, + "total_request_s": 95.97086218500044, + "output_tokens": 22, + "answer": "CEDAR-731|MARBLE-482|QUARTZ-956", + "reused_tokens": 0, + "correct_code_pairs": 3, + "complete": true, + "peak_gpu_gib": 70.7705078125, + "peak_engine_rss_gib": 43.3382568359375, + "native_prompt_tokens": 524288, + "native_reused_tokens": 0, + "prefill_s": 95.686, + "prefill_tps": 5479.2, + "decode_tps": 103.6 + }, + { + "input_tokens": 1048576, + "input_sha256": "48b438a93ce5281f1b19a2303cfb5986d941c9d205370746157b7c335d42e69b", + "rope": "none", + "capacity": 1048832, + "argv": [ + "--pack", + "$PACK", + "--native", + "$GGUF_SHARD_1", + "--ple-gguf", + "$GGUF_SHARD_2", + "--expert-profile", + "$EXPERT_PROFILE", + "--expert-cache", + "auto", + "--stats", + "--vram-reserve-mib", + "1024", + "--kv", + "fp16", + "--spec", + "2", + "--suffix-draft", + "0", + "--conversation-cache-mib", + "0", + "--prefill", + "8192", + "--max-context", + "1048832", + "--rope-scaling", + "none" + ], + "expected": "CEDAR-731|MARBLE-482|QUARTZ-956", + "executable_sha256": "6d1ff96c482bec4ac3c5d277b61554ca4f2db29e285952f9928df669a950ae1a", + "samples_per_condition": 1, + "startup_s": 11.448991140001453, + "ttft_s": 235.7052494530799, + "total_request_s": 235.95347971608862, + "output_tokens": 22, + "answer": "CEDAR-482|MARBLE-956|QUARTZ-731", + "reused_tokens": 0, + "correct_code_pairs": 0, + "complete": true, + "peak_gpu_gib": 70.7666015625, + "peak_engine_rss_gib": 43.36387252807617, + "native_prompt_tokens": 1048576, + "native_reused_tokens": 0, + "prefill_s": 235.522, + "prefill_tps": 4452.1, + "decode_tps": 82.4 + }, + { + "input_tokens": 1048576, + "input_sha256": "48b438a93ce5281f1b19a2303cfb5986d941c9d205370746157b7c335d42e69b", + "rope": "yarn", + "capacity": 1048832, + "argv": [ + "--pack", + "$PACK", + "--native", + "$GGUF_SHARD_1", + "--ple-gguf", + "$GGUF_SHARD_2", + "--expert-profile", + "$EXPERT_PROFILE", + "--expert-cache", + "auto", + "--stats", + "--vram-reserve-mib", + "1024", + "--kv", + "fp16", + "--spec", + "2", + "--suffix-draft", + "0", + "--conversation-cache-mib", + "0", + "--prefill", + "8192", + "--max-context", + "1048832", + "--rope-scaling", + "yarn", + "--rope-scale", + "4", + "--yarn-orig-ctx", + "262144" + ], + "expected": "CEDAR-731|MARBLE-482|QUARTZ-956", + "executable_sha256": "6d1ff96c482bec4ac3c5d277b61554ca4f2db29e285952f9928df669a950ae1a", + "samples_per_condition": 1, + "startup_s": 11.46149045205675, + "ttft_s": 232.95247090701014, + "total_request_s": 233.1999127130257, + "output_tokens": 22, + "answer": "CEDAR-731|MARBLE-482|QUARTZ-956", + "reused_tokens": 0, + "correct_code_pairs": 3, + "complete": true, + "peak_gpu_gib": 70.7685546875, + "peak_engine_rss_gib": 43.364803314208984, + "native_prompt_tokens": 1048576, + "native_reused_tokens": 0, + "prefill_s": 232.771, + "prefill_tps": 4504.8, + "decode_tps": 82.7 + } + ], + "limitations": [ + "one prompt per condition, three associations amid repeated filler", + "no validated switching cutoff", + "short generated answers; decode estimates are not sustained-throughput measurements", + "no cache migration in these runs", + "repository revision of the downloaded model was not recorded" + ] +}