[PR #2015] [CLOSED] Draft: immutable branching contexts with serialized execution and shared checkpoints #3807

Closed
opened 2026-11-07 15:30:53 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/2015
Author: @CC-David-CC
Created: 10/12/2026
Status: ❌ Closed

Base: main ← Head: feat/immutable-branching-upstream


📝 Commits (10+)

  • ee96335 Add immutable branching context foundation on upstream main
  • ed5c455 Port optional-draft cold snapshots to current main
  • 6dd5f9d Record bounded CUDA validation and issue scope for the upstream draft
  • 15fb044 Add resumable Luna branching-context handoff harness
  • 6e651a1 Preserve Luna checkpoint and host-buffer implementation work
  • 3f77d95 Repair idle feeds and host view lifetime with executed regression evidence
  • b6dc6fc Repair native cache admission and validate exact consumed-history lookup
  • 0b96187 Preserve canonical input identity through cold-to-hot checkpoint restore
  • e10e78e Implement native RAM-cache capture and exact consumed-frontier restore
  • 8aa223a Route canonical cache misses through native RAM and replace duplicate checkpoints

📊 Changes

172 files changed (+42787 additions, -67 deletions)

View changed files

📝 CMakeLists.txt (+60 -0)
➕ experimental/branching_context/.gitattributes (+2 -0)
➕ experimental/branching_context/.gitignore (+4 -0)
➕ experimental/branching_context/AGENTS.md (+58 -0)
➕ experimental/branching_context/README.md (+185 -0)
➕ experimental/branching_context/docs/acceptance.json (+517 -0)
➕ experimental/branching_context/docs/architecture.md (+96 -0)
➕ experimental/branching_context/docs/backend-adapter.md (+65 -0)
➕ experimental/branching_context/docs/certification.md (+81 -0)
➕ experimental/branching_context/docs/locked-references.json (+7 -0)
➕ experimental/branching_context/docs/test-matrix.md (+133 -0)
➕ experimental/branching_context/evidence/DECISIONS.md (+356 -0)
➕ experimental/branching_context/evidence/STATUS.md (+432 -0)
➕ experimental/branching_context/evidence/automatic-ram-validation.json (+810 -0)
➕ experimental/branching_context/evidence/cold-identity-validation.json (+442 -0)
➕ experimental/branching_context/evidence/current-native-validation.json (+76 -0)
➕ experimental/branching_context/evidence/dispatch-correction-validation.json (+2242 -0)
➕ experimental/branching_context/evidence/draft-data/fresh-forwards.json (+246 -0)
➕ experimental/branching_context/evidence/draft-data/measurements.jsonl (+49 -0)
➕ experimental/branching_context/evidence/draft-data/native.jsonl (+330 -0)

...and 80 more files

📄 Description

Branch from a consumed prefix, advance independent futures, and rewind movable branch references without changing canonical history. Optional CUDA and host-RAM checkpoints accelerate replay; complete checkpoint eviction preserves the history needed to rebuild.

This is a foundation for #1938 and #1962, not a claim that either request is complete.

Current prototype

  • One canonical immutable history and controller representation, revision-checked branch moves, and durable consumed-token publication.
  • Shared CUDA allocations with copy-on-write, native host-RAM snapshots, exact-history reuse, and direct allocation/ownership/work counters.
  • Owner-affine execution leases and a simple FIFO slot queue. Execution is explicitly serialized on one backend workspace; queued cancellation, slot reuse and interrupted publication have regression coverage.
  • A separately linked, uncached full-history oracle that accepts no branch checkpoint or retained handle.

Corrected validation

Linux, RTX 4090, Qwen3.8-Flash-Next Q8_0 weights, FP16 KV:

  • Eight supporting test methods passed, with 34 exact full-vocabulary comparisons; maximum absolute logit error 0.0. No skips or expected failures in these passing runs.
  • Four comparisons match ordinary execution for the one-token control. Thirty compare branching operations against fresh full-history forwards, with 296 oracle-computed tokens.
  • Coverage includes controller state, ownership, FIFO execution, interrupted publication, slot reuse, RAM restoration and complete checkpoint eviction. RAM hits avoided prefix computation; changed and fully evicted prefixes replayed their nine tokens.
  • G0: 51/51. All four reference mutants detected.

Both private drivers previously omitted resident expert contributions because they did not bind the expert dispatch plan. The fix corrects both drivers. Earlier branch/oracle agreement shared that defect and does not establish ordinary-model correctness. The controlled regression failed before the fix (maximum error 1.1226537227630615) and passed exactly afterward. No tolerance or reference equation was relaxed. Actual PCIe expert execution was not exercised by this fixture.

Executed evidence and fingerprints

Help wanted: batched-prefill equivalence

The immediate priority is a reliable one-request-at-a-time prototype. Batched execution is not required for that milestone, but ordinary batched-prefill equivalence must be resolved before claiming general serving-path parity.

Help tracing differences between ordinary prefill chunks and the pinned token-level operator is welcome, especially expert dispatch, placement and accumulation order. Full diagnostic vectors and work counts were preserved; the historical maximum 1.5612177848815918 is an absolute logit difference, not a percentage or an accepted tolerance. The dispatch fix establishes the one-token control, not multi-token equivalence.

Preserved prefill diagnosis

Remaining scope

Draft validation only. The current numerical profile is unqualified and no cumulative G1-G5 PASS is claimed. Full current-build suites, crash/OOM campaigns, evaluation/adoption workflow, release hardening, performance qualification and conversation-server integration remain. The unchanged native conversation snapshot test still fails its same-address growth expectation. HIP/SYCL builds, native Windows persistence and image inputs are unvalidated or unsupported.

The feature remains experimental and opt-in. Default serving-path parity has not been fully established. The Python store currently requires POSIX fcntl.

Build, usage and limitations


🔄 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/2015 **Author:** [@CC-David-CC](https://github.com/CC-David-CC) **Created:** 10/12/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `feat/immutable-branching-upstream` --- ### 📝 Commits (10+) - [`ee96335`](https://github.com/Niko1221/Strata/commit/ee9633569abba68433f5c1797b0048a7f2f3624b) Add immutable branching context foundation on upstream main - [`ed5c455`](https://github.com/Niko1221/Strata/commit/ed5c45574877ccb17f791ccf394bc3103717ee6f) Port optional-draft cold snapshots to current main - [`6dd5f9d`](https://github.com/Niko1221/Strata/commit/6dd5f9df7e1aa7f00045cf72e997fd8595175847) Record bounded CUDA validation and issue scope for the upstream draft - [`15fb044`](https://github.com/Niko1221/Strata/commit/15fb044e523cb0097ba13829f1a867edf1a02af4) Add resumable Luna branching-context handoff harness - [`6e651a1`](https://github.com/Niko1221/Strata/commit/6e651a151e3fcea484ccdacb0a8a1482bc129b2c) Preserve Luna checkpoint and host-buffer implementation work - [`3f77d95`](https://github.com/Niko1221/Strata/commit/3f77d95eb1eecfcd70d2659683124fbfdda617d3) Repair idle feeds and host view lifetime with executed regression evidence - [`b6dc6fc`](https://github.com/Niko1221/Strata/commit/b6dc6fc5e72e19cd6f729403f0d163a49fff098c) Repair native cache admission and validate exact consumed-history lookup - [`0b96187`](https://github.com/Niko1221/Strata/commit/0b961870ab4343061994afe608206ad8c012e313) Preserve canonical input identity through cold-to-hot checkpoint restore - [`e10e78e`](https://github.com/Niko1221/Strata/commit/e10e78e9dac9d1ced4adfbf21e227ba88bd50f90) Implement native RAM-cache capture and exact consumed-frontier restore - [`8aa223a`](https://github.com/Niko1221/Strata/commit/8aa223ab4a0904bd8d8a2cfb42ebc0a2241e7f51) Route canonical cache misses through native RAM and replace duplicate checkpoints ### 📊 Changes **172 files changed** (+42787 additions, -67 deletions) <details> <summary>View changed files</summary> 📝 `CMakeLists.txt` (+60 -0) ➕ `experimental/branching_context/.gitattributes` (+2 -0) ➕ `experimental/branching_context/.gitignore` (+4 -0) ➕ `experimental/branching_context/AGENTS.md` (+58 -0) ➕ `experimental/branching_context/README.md` (+185 -0) ➕ `experimental/branching_context/docs/acceptance.json` (+517 -0) ➕ `experimental/branching_context/docs/architecture.md` (+96 -0) ➕ `experimental/branching_context/docs/backend-adapter.md` (+65 -0) ➕ `experimental/branching_context/docs/certification.md` (+81 -0) ➕ `experimental/branching_context/docs/locked-references.json` (+7 -0) ➕ `experimental/branching_context/docs/test-matrix.md` (+133 -0) ➕ `experimental/branching_context/evidence/DECISIONS.md` (+356 -0) ➕ `experimental/branching_context/evidence/STATUS.md` (+432 -0) ➕ `experimental/branching_context/evidence/automatic-ram-validation.json` (+810 -0) ➕ `experimental/branching_context/evidence/cold-identity-validation.json` (+442 -0) ➕ `experimental/branching_context/evidence/current-native-validation.json` (+76 -0) ➕ `experimental/branching_context/evidence/dispatch-correction-validation.json` (+2242 -0) ➕ `experimental/branching_context/evidence/draft-data/fresh-forwards.json` (+246 -0) ➕ `experimental/branching_context/evidence/draft-data/measurements.jsonl` (+49 -0) ➕ `experimental/branching_context/evidence/draft-data/native.jsonl` (+330 -0) _...and 80 more files_ </details> ### 📄 Description Branch from a consumed prefix, advance independent futures, and rewind movable branch references without changing canonical history. Optional CUDA and host-RAM checkpoints accelerate replay; complete checkpoint eviction preserves the history needed to rebuild. This is a foundation for #1938 and #1962, not a claim that either request is complete. ## Current prototype - One canonical immutable history and controller representation, revision-checked branch moves, and durable consumed-token publication. - Shared CUDA allocations with copy-on-write, native host-RAM snapshots, exact-history reuse, and direct allocation/ownership/work counters. - Owner-affine execution leases and a simple FIFO slot queue. Execution is explicitly serialized on one backend workspace; queued cancellation, slot reuse and interrupted publication have regression coverage. - A separately linked, uncached full-history oracle that accepts no branch checkpoint or retained handle. ## Corrected validation Linux, RTX 4090, Qwen3.8-Flash-Next Q8_0 weights, FP16 KV: - Eight supporting test methods passed, with 34 exact full-vocabulary comparisons; maximum absolute logit error 0.0. No skips or expected failures in these passing runs. - Four comparisons match ordinary execution for the one-token control. Thirty compare branching operations against fresh full-history forwards, with 296 oracle-computed tokens. - Coverage includes controller state, ownership, FIFO execution, interrupted publication, slot reuse, RAM restoration and complete checkpoint eviction. RAM hits avoided prefix computation; changed and fully evicted prefixes replayed their nine tokens. - G0: 51/51. All four reference mutants detected. Both private drivers previously omitted resident expert contributions because they did not bind the expert dispatch plan. The fix corrects both drivers. Earlier branch/oracle agreement shared that defect and does not establish ordinary-model correctness. The controlled regression failed before the fix (maximum error 1.1226537227630615) and passed exactly afterward. No tolerance or reference equation was relaxed. Actual PCIe expert execution was not exercised by this fixture. [Executed evidence and fingerprints](https://github.com/CC-David-CC/Strata-a5500/blob/68c0459894deae0b6641914e5efdba9a479fecf3/experimental/branching_context/evidence/dispatch-correction-validation.json) ## Help wanted: batched-prefill equivalence The immediate priority is a reliable one-request-at-a-time prototype. Batched execution is not required for that milestone, but ordinary batched-prefill equivalence must be resolved before claiming general serving-path parity. Help tracing differences between ordinary prefill chunks and the pinned token-level operator is welcome, especially expert dispatch, placement and accumulation order. Full diagnostic vectors and work counts were preserved; the historical maximum 1.5612177848815918 is an absolute logit difference, not a percentage or an accepted tolerance. The dispatch fix establishes the one-token control, not multi-token equivalence. [Preserved prefill diagnosis](https://github.com/CC-David-CC/Strata-a5500/blob/68c0459894deae0b6641914e5efdba9a479fecf3/experimental/branching_context/evidence/normal-prefill-validation.json) ## Remaining scope Draft validation only. The current numerical profile is unqualified and no cumulative G1-G5 PASS is claimed. Full current-build suites, crash/OOM campaigns, evaluation/adoption workflow, release hardening, performance qualification and conversation-server integration remain. The unchanged native conversation snapshot test still fails its same-address growth expectation. HIP/SYCL builds, native Windows persistence and image inputs are unvalidated or unsupported. The feature remains experimental and opt-in. Default serving-path parity has not been fully established. The Python store currently requires POSIX fcntl. [Build, usage and limitations](https://github.com/CC-David-CC/Strata-a5500/blob/68c0459894deae0b6641914e5efdba9a479fecf3/experimental/branching_context/README.md) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 15:30:53 +07:00
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#3807
No description provided.