[PR #3247] [Benchmark] NCM feasibility study: stop/document, no engine change #4525

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

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/3247
Author: @toel1234
Created: 10/19/2026
Status: 🔄 Open

Base: main ← Head: benchmark/ncm-feasibility


📝 Commits (1)

  • aa9cb1d [Benchmark] NCM feasibility study: stop/document, no engine change

📊 Changes

43 files changed (+5928 additions, -0 deletions)

View changed files

➕ docs/NCM.md (+848 -0)
➕ docs/benchmarks/ncm-2026-10-19-rtx5070/README.md (+20 -0)
➕ docs/benchmarks/ncm-2026-10-19-rtx5070/standalone-probe.json (+148 -0)
➕ docs/benchmarks/ncm-2026-10-19-rtx5070/target/code.default.command.json (+33 -0)
➕ docs/benchmarks/ncm-2026-10-19-rtx5070/target/code.default.stderr (+44 -0)
➕ docs/benchmarks/ncm-2026-10-19-rtx5070/target/code.default.stdout (+16 -0)
➕ docs/benchmarks/ncm-2026-10-19-rtx5070/target/code.mtp.command.json (+35 -0)
➕ docs/benchmarks/ncm-2026-10-19-rtx5070/target/code.mtp.stderr (+42 -0)
➕ docs/benchmarks/ncm-2026-10-19-rtx5070/target/code.mtp.stdout (+15 -0)
➕ docs/benchmarks/ncm-2026-10-19-rtx5070/target/code.oracle.ids (+1 -0)
➕ docs/benchmarks/ncm-2026-10-19-rtx5070/target/code.oracle4.command.json (+37 -0)
➕ docs/benchmarks/ncm-2026-10-19-rtx5070/target/code.oracle4.stderr (+40 -0)
➕ docs/benchmarks/ncm-2026-10-19-rtx5070/target/code.oracle4.stdout (+14 -0)
➕ docs/benchmarks/ncm-2026-10-19-rtx5070/target/code.oracle8.command.json (+37 -0)
➕ docs/benchmarks/ncm-2026-10-19-rtx5070/target/code.oracle8.stderr (+40 -0)
➕ docs/benchmarks/ncm-2026-10-19-rtx5070/target/code.oracle8.stdout (+14 -0)
➕ docs/benchmarks/ncm-2026-10-19-rtx5070/target/code.plain.command.json (+35 -0)
➕ docs/benchmarks/ncm-2026-10-19-rtx5070/target/code.plain.stderr (+41 -0)
➕ docs/benchmarks/ncm-2026-10-19-rtx5070/target/code.plain.stdout (+14 -0)
➕ docs/benchmarks/ncm-2026-10-19-rtx5070/target/code.prompt.ids (+1 -0)

...and 23 more files

📄 Description

Problem and result

NCM (HazyResearch) generates many tokens per pass. The question was whether it could be a faster draft source
for Strata's speculative decoding. Result: not now. No released NCM checkpoint drafts in the target's token IDs,
so no NCM acceptance could be measured. This PR records the study, its numbers and its limits. Strata's
behaviour does not change.

Measured on RTX 5070 (12 GB), Ryzen 9 7900X, Linux, existing engine 0.1.45 binary, checkout e88ee39d:

  • NCM TinyStories checkpoint, standalone: 40.504 ms median for 128 TinyStories BPE tokens (FP32, batch 1, 20 runs).
  • Swift 1.5 IQ2_XS, 64 greedy tokens, single runs: MTP only 19.58 / 19.01 tok/s, default lookup 20.15 / 18.79
    (prose / code). Perfect 8-token oracle drafts: 38.18 / 30.59. All outputs matched their greedy reference.
  • Routed expert union per layer, 4 / 8-token windows: 25.4 / 40.8 (prose), 27.7 / 45.0 (code).
  • Calculated, not measured: an NCM drafter would need conditional acceptance of about 0.83 to 0.96 to beat
    the baseline.

none. Research and benchmark report only; no feature, refactor or default change.

Approach

  • docs/NCM.md: plain summary, source review, measurements, break-even model, validation, decision.
  • docs/benchmarks/ncm-2026-10-19-rtx5070/: raw files (probe JSON, results.json, every engine argument list,
    stdout/stderr, prompt and oracle IDs, Terminal test log). Local paths rewritten to $STRATA, $DATA, $OUT.
    Routing traces (1.1 MB) not included; SHA-256 recorded.
  • tools/ncm_probe.py: standalone NCM probe and a break-even calculator (no PyTorch needed for the calculator).
  • tools/ncm_target_bench.py: the target pilot driver, with paths as arguments.

Validation

Passed:

  • Ten engine runs (two prompts × MTP, default, greedy reference, oracle 4, oracle 8) exited 0; all 64-token outputs
    equal to the greedy reference. Data in docs/benchmarks/ncm-2026-10-19-rtx5070/target/results.json.
  • Standalone probe, 3 warm-up + 20 measured generations, checkpoint SHA-256 values in the doc.
  • tools/ncm_target_bench.py rebuilds the same ten argument lists as the recorded *.command.json and recomputes
    the same routing unions from the original traces (checked without running the engine again).
  • python3 -I tools/ncm_probe.py --break-even --window 4 --baseline-tps 80 --verify-ms 30 --draft-ms 5 gives the
    threshold in the doc. JSON files parse; all relative links in the new docs resolve.
  • git diff --exit-code -- src include serve strata_cli strata_control apps requirements.txt requirements-monitor.txt
    returned 0.

Failed:

  • python -m pytest tests/terminal -q on e88ee39d (before this change, no Terminal code touched): 834 passed,
    18 failed, 17 skipped. Log: docs/benchmarks/ncm-2026-10-19-rtx5070/terminal-tests.log. Not diagnosed here.

Not run:

  • CUDA/HIP/SYCL/Metal builds: no engine code changed.
  • NCM acceptance against the target, retokenization, shared-VRAM residency, 16-token windows (kVerifyMaxT = 8),
    repeated or interleaved runs, the full benchmark protocol.

Limits

Single short runs on one machine, diagnostic settings (context 4096, KV residency 0, mapped experts), not the saved
production configuration. No speedup is claimed. The oracle rows are an upper bound for an 8-token drafter in this
setup, not a result for NCM.

🤖 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/3247 **Author:** [@toel1234](https://github.com/toel1234) **Created:** 10/19/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `benchmark/ncm-feasibility` --- ### 📝 Commits (1) - [`aa9cb1d`](https://github.com/Niko1221/Strata/commit/aa9cb1d4f7ee7f9a762a7629257e580932f4d35a) [Benchmark] NCM feasibility study: stop/document, no engine change ### 📊 Changes **43 files changed** (+5928 additions, -0 deletions) <details> <summary>View changed files</summary> ➕ `docs/NCM.md` (+848 -0) ➕ `docs/benchmarks/ncm-2026-10-19-rtx5070/README.md` (+20 -0) ➕ `docs/benchmarks/ncm-2026-10-19-rtx5070/standalone-probe.json` (+148 -0) ➕ `docs/benchmarks/ncm-2026-10-19-rtx5070/target/code.default.command.json` (+33 -0) ➕ `docs/benchmarks/ncm-2026-10-19-rtx5070/target/code.default.stderr` (+44 -0) ➕ `docs/benchmarks/ncm-2026-10-19-rtx5070/target/code.default.stdout` (+16 -0) ➕ `docs/benchmarks/ncm-2026-10-19-rtx5070/target/code.mtp.command.json` (+35 -0) ➕ `docs/benchmarks/ncm-2026-10-19-rtx5070/target/code.mtp.stderr` (+42 -0) ➕ `docs/benchmarks/ncm-2026-10-19-rtx5070/target/code.mtp.stdout` (+15 -0) ➕ `docs/benchmarks/ncm-2026-10-19-rtx5070/target/code.oracle.ids` (+1 -0) ➕ `docs/benchmarks/ncm-2026-10-19-rtx5070/target/code.oracle4.command.json` (+37 -0) ➕ `docs/benchmarks/ncm-2026-10-19-rtx5070/target/code.oracle4.stderr` (+40 -0) ➕ `docs/benchmarks/ncm-2026-10-19-rtx5070/target/code.oracle4.stdout` (+14 -0) ➕ `docs/benchmarks/ncm-2026-10-19-rtx5070/target/code.oracle8.command.json` (+37 -0) ➕ `docs/benchmarks/ncm-2026-10-19-rtx5070/target/code.oracle8.stderr` (+40 -0) ➕ `docs/benchmarks/ncm-2026-10-19-rtx5070/target/code.oracle8.stdout` (+14 -0) ➕ `docs/benchmarks/ncm-2026-10-19-rtx5070/target/code.plain.command.json` (+35 -0) ➕ `docs/benchmarks/ncm-2026-10-19-rtx5070/target/code.plain.stderr` (+41 -0) ➕ `docs/benchmarks/ncm-2026-10-19-rtx5070/target/code.plain.stdout` (+14 -0) ➕ `docs/benchmarks/ncm-2026-10-19-rtx5070/target/code.prompt.ids` (+1 -0) _...and 23 more files_ </details> ### 📄 Description ## Problem and result NCM (HazyResearch) generates many tokens per pass. The question was whether it could be a faster draft source for Strata's speculative decoding. Result: not now. No released NCM checkpoint drafts in the target's token IDs, so no NCM acceptance could be measured. This PR records the study, its numbers and its limits. Strata's behaviour does not change. Measured on RTX 5070 (12 GB), Ryzen 9 7900X, Linux, existing engine 0.1.45 binary, checkout e88ee39d: - NCM TinyStories checkpoint, standalone: 40.504 ms median for 128 TinyStories BPE tokens (FP32, batch 1, 20 runs). - Swift 1.5 IQ2_XS, 64 greedy tokens, single runs: MTP only 19.58 / 19.01 tok/s, default lookup 20.15 / 18.79 (prose / code). Perfect 8-token oracle drafts: 38.18 / 30.59. All outputs matched their greedy reference. - Routed expert union per layer, 4 / 8-token windows: 25.4 / 40.8 (prose), 27.7 / 45.0 (code). - Calculated, not measured: an NCM drafter would need conditional acceptance of about 0.83 to 0.96 to beat the baseline. ## Related discussion none. Research and benchmark report only; no feature, refactor or default change. ## Approach - `docs/NCM.md`: plain summary, source review, measurements, break-even model, validation, decision. - `docs/benchmarks/ncm-2026-10-19-rtx5070/`: raw files (probe JSON, results.json, every engine argument list, stdout/stderr, prompt and oracle IDs, Terminal test log). Local paths rewritten to `$STRATA`, `$DATA`, `$OUT`. Routing traces (1.1 MB) not included; SHA-256 recorded. - `tools/ncm_probe.py`: standalone NCM probe and a break-even calculator (no PyTorch needed for the calculator). - `tools/ncm_target_bench.py`: the target pilot driver, with paths as arguments. ## Validation **Passed:** - Ten engine runs (two prompts × MTP, default, greedy reference, oracle 4, oracle 8) exited 0; all 64-token outputs equal to the greedy reference. Data in `docs/benchmarks/ncm-2026-10-19-rtx5070/target/results.json`. - Standalone probe, 3 warm-up + 20 measured generations, checkpoint SHA-256 values in the doc. - `tools/ncm_target_bench.py` rebuilds the same ten argument lists as the recorded `*.command.json` and recomputes the same routing unions from the original traces (checked without running the engine again). - `python3 -I tools/ncm_probe.py --break-even --window 4 --baseline-tps 80 --verify-ms 30 --draft-ms 5` gives the threshold in the doc. JSON files parse; all relative links in the new docs resolve. - `git diff --exit-code -- src include serve strata_cli strata_control apps requirements.txt requirements-monitor.txt` returned 0. **Failed:** - `python -m pytest tests/terminal -q` on e88ee39d (before this change, no Terminal code touched): 834 passed, 18 failed, 17 skipped. Log: `docs/benchmarks/ncm-2026-10-19-rtx5070/terminal-tests.log`. Not diagnosed here. **Not run:** - CUDA/HIP/SYCL/Metal builds: no engine code changed. - NCM acceptance against the target, retokenization, shared-VRAM residency, 16-token windows (`kVerifyMaxT = 8`), repeated or interleaved runs, the full benchmark protocol. ## Limits Single short runs on one machine, diagnostic settings (context 4096, KV residency 0, mapped experts), not the saved production configuration. No speedup is claimed. The oracle rows are an upper bound for an 8-token drafter in this setup, not a result for NCM. 🤖 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#4525
No description provided.