Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
9804b0c
Suffix-reuse overlay on v0.1.43: Phase 3b partial-prefix mount + 5 wi…
Oct 12, 2026
daf78f1
k8v4 hybrid: accept the splice (K half is byte-identical int8)
Oct 12, 2026
da7f9f9
int8 + STRATA_KV_ROT=1: splice via the exact Hadamard sandwich
Oct 12, 2026
568c13f
q4_0: splice via the Q4-sandwich (dequant Q4 -> H -> R(delta) -> H ->…
Oct 12, 2026
58a5fa4
kv_splice_apply_int8.hpp: include kv_q4.hpp (block_q4_0, QK4_0)
Oct 12, 2026
f1c6516
review r1 MINOR-1: partial-mount UnsupportedFormat reason string refr…
Oct 12, 2026
389d2fe
review r1 MINOR-2: T11.c q4_0 label reworded (mechanics unchanged; q4…
Oct 12, 2026
83e6887
review r1 MINOR-3: file-header + guard docstrings refreshed to the al…
Oct 12, 2026
e729de3
review r1 MINOR-3 (b): splice_scope_guard_int8 docstring updated to a…
Oct 12, 2026
d4233ab
help text: plain-words rewrite of the suffix-reuse arg hints (AGENTS.…
Oct 13, 2026
6e2388f
docs: SUFFIX_REUSE.md — design, benchmarks and references for suffix-…
Oct 13, 2026
120208f
FW-1 dense-tail cadence: pure function + validator + unit test (TDD)
Oct 13, 2026
4c200dc
FW-1: wire --prompt-cache-dense-tail into the prompt pass
Oct 13, 2026
9e075e2
FW-1: dynamic chunk sizing - anchor boundaries at dense-tail cadence
Oct 13, 2026
d9fd353
FW-1: splice engagement - deeper partial beats shallower strict (T16)
Oct 13, 2026
3041519
FW-1 probe: local-search + parked-scan + per-candidate LCP DBG lines …
Oct 13, 2026
653ce05
FW-1: live-anchor partial mount - lift the three L>prompt size guards…
Oct 13, 2026
daa7125
FW-1: replay-gated gap read - fail-closed partial mount (T18)
Oct 13, 2026
6d6b3a1
FW-2a probe (T19): checkpoint cost decomposition - sync 0.0ms, save ~…
Oct 13, 2026
e8ff0ae
FW-2a fix (T21): periodic gate reads per-request pp_next_check - warm…
Oct 13, 2026
70e768a
review r1 fix 1 (MAJOR): cross-conversation partial never mounts shal…
Oct 13, 2026
8dd4525
review r1 fix 2 (MINOR): restore --prompt-cache-tail help paragraph s…
Oct 13, 2026
dbe451d
docs: extend SUFFIX_REUSE with sfx-future results (dense-tail, P0e ca…
Oct 13, 2026
d1a2eae
FW-2b (T22): state-cadence pure seam - two-pool restore pick + fine-c…
Oct 13, 2026
be98442
FW-2b (T23): --prompt-cache-state-every N - fine-cadence state checkp…
Oct 13, 2026
355f525
FW-2b: state pool byte cap 256MiB -> 2GiB (measured blob sizes)
Oct 13, 2026
1118fe9
docs: FW-2b results in SUFFIX_REUSE (state-cadence closes the needle …
Oct 13, 2026
bf94246
docs: FW-2c design notes (session-local partial K/V splice) - recon +…
Oct 13, 2026
414047e
docs: 3-seed A/B honesty update - FW-2b is a reuse win, reward-neutra…
Oct 13, 2026
455e6b5
docs: FW-2b-stack re-cert table - strongest of the campaign
Oct 13, 2026
adea075
docs: quant sweep - all 5 KV formats GREEN with identical reuse on FW-2b
Oct 13, 2026
9e41831
docs: bring 8/9/10 current - three flags, 82/0 counts, FW-2b review l…
Oct 13, 2026
ebc6c15
docs: FW-2c parked with full implementation plan (state-advance kernel)
Oct 13, 2026
98e0807
docs: header covers all three stacked layers incl. sfx-fw2b
justindressler Oct 14, 2026
02c6feb
sfx: fix rebase artifacts on v0.1.45 — orphan scope closers in genera…
Oct 17, 2026
c0ae742
review r3 (mm, v0.1.45 rebase): refresh stale refusal reason strings …
Oct 17, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -767,6 +767,15 @@ if(STRATA_ENABLE_CUDA OR STRATA_ENABLE_HIP)
target_link_libraries(strata PRIVATE delayimp)
target_link_options(strata PRIVATE "LINKER:/DELAYLOAD:hipblas.dll" "LINKER:/DELAYLOAD:libhipblaslt.dll" "LINKER:/DELAYLOAD:rocblas.dll")
endif()
# 2026-10-12 splice hotfix round 2: generate.cpp is a G++ (host) TU even in a CUDA build, so
# the __CUDACC__ per-TU trigger in kv_splice_transport.hpp never fires for it. Mark the
# whole build so the transport activates for EVERY TU of this target (NVCC or g++), and the
# fail-closed #error in the header catches any TU that sees it in a CUDA build without one.
# Rebase onto v0.2.1.4: 0.2.x builds CPU-only too, where the macro would make the header
# include <cuda_runtime.h> and fire its own fail-closed #error, so scope it to GPU builds.
if(STRATA_ENABLE_CUDA OR STRATA_ENABLE_HIP)
target_compile_definitions(strata PRIVATE STRATA_HAVE_CUDA_BUILD=1)
endif()

# NEW-MODELS-PLAN.md T1: Qwen3.6-35B-A3B's reference path (one GPU, the model resident, plain kernels), checked
# against llama.cpp by tools/qwen35/; the engine itself does not run the family yet
Expand Down Expand Up @@ -1464,6 +1473,63 @@ if(STRATA_BUILD_TESTS OR STRATA_BUILD_CONVERSATION_TESTS)
add_executable(conv_cache_test src/program/conv_cache_test.cpp)
target_include_directories(conv_cache_test PRIVATE include)
add_test(NAME conv_cache_test COMMAND conv_cache_test)
# the suffix-reuse plan computation: longest-common-tail splice plan over a re-edited prompt
# (header-only, CPU; gated by STRATA_BUILD_CONVERSATION_TESTS so the test suite can opt in standalone)
if(STRATA_BUILD_CONVERSATION_TESTS)
add_executable(suffix_reuse_test src/program/suffix_reuse_test.cpp)
target_include_directories(suffix_reuse_test PRIVATE include)
add_test(NAME suffix_reuse_test COMMAND suffix_reuse_test)
# A2.3: flag-off parity is a ctest, not a grep. CPU-only; gate on the same flag as
# suffix_reuse_test so it can opt in alongside the conversation tests.
add_executable(suffix_reuse_off_parity_test src/program/suffix_reuse_off_parity_test.cpp)
target_include_directories(suffix_reuse_off_parity_test PRIVATE include)
add_test(NAME suffix_reuse_off_parity_test COMMAND suffix_reuse_off_parity_test)
# Phase 2 Task 3 T6: the splice-wiring test (synthesises QsaState, hand-crafts K rows,
# runs rotate_qsa_tail_inplace, asserts K matches fresh rotation to 1e-6 + V byte-identical
# + SPLICE_UNSUPPORTED guard fires for unsupported configs).
add_executable(suffix_reuse_apply_test src/program/suffix_reuse_apply_test.cpp)
target_include_directories(suffix_reuse_apply_test PRIVATE include)
add_executable(suffix_reuse_dense_tail_test src/program/suffix_reuse_dense_tail_test.cpp)
target_include_directories(suffix_reuse_dense_tail_test PRIVATE include)
add_test(NAME suffix_reuse_dense_tail_test COMMAND suffix_reuse_dense_tail_test)
add_test(NAME suffix_reuse_apply_test COMMAND suffix_reuse_apply_test)
# Phase 2 hotfix T7: the device-path regression for the 2026-10-12 SIGSEGV. Pins the
# LIVE failing inputs (edit_pos=3239, old_suffix_len=1, uniform delta=+54) plus the
# non-uniform path and the null-deltas guard, all on a PROT_NONE "device" region
# (PROT_NONE faults on any host deref, exactly as a discrete-GPU address would).
# CPU-only: the test supplies a fake-cuda API in its own TU; no <cuda_runtime.h>.
# RED->GREEN: removing the transport from kv_splice_transport.hpp makes this SEGV.
add_executable(suffix_reuse_device_test src/program/suffix_reuse_device_test.cpp)
target_include_directories(suffix_reuse_device_test PRIVATE include)
target_compile_definitions(suffix_reuse_device_test PRIVATE
STRATA_SPLICE_TRANSPORT=1 STRATA_SPLICE_FAKE_CUDA=1)
add_test(NAME suffix_reuse_device_test COMMAND suffix_reuse_device_test)
add_executable(suffix_reuse_resume_narrowing_test src/program/suffix_reuse_resume_narrowing_test.cpp)
target_include_directories(suffix_reuse_resume_narrowing_test PRIVATE include)
add_test(NAME suffix_reuse_resume_narrowing_test COMMAND suffix_reuse_resume_narrowing_test)
# Phase 3a T9+T10: continuation-mount parity (the 0% vs 98% off-arm regression - the
# splice hook's suffix walk mis-IDs a pure continuation as a 1-token edit and destroys
# the mount) + anchor-splice engagement (the splice's K rotation is wasted because the
# chunk loop re-reads [anchor, n) instead of [edit, n) - the gap-read is the splice's
# saved work). CPU-only header test on the pure helpers in suffix_reuse.hpp.
add_executable(suffix_reuse_continuation_and_anchor_test src/program/suffix_reuse_continuation_and_anchor_test.cpp)
target_include_directories(suffix_reuse_continuation_and_anchor_test PRIVATE include)
add_test(NAME suffix_reuse_continuation_and_anchor_test COMMAND suffix_reuse_continuation_and_anchor_test)
# Phase 3 T11: the INT8 KV splice (dequant -> rotate -> requant). Exercises
# kv_splice_apply_int8.hpp + kv_q8_quant.hpp on a synthesised int8 QsaState;
# mirrors the writer's quant math (src/kernels/cuda/kv_q8.cu:47-67) so a
# requant(dequant(block)) is BIT-IDENTICAL and the rotated cell is bounded by
# the writer's per-group half-step. Header-only / CPU.
add_executable(suffix_reuse_int8_test src/program/suffix_reuse_int8_test.cpp)
target_include_directories(suffix_reuse_int8_test PRIVATE include)
add_test(NAME suffix_reuse_int8_test COMMAND suffix_reuse_int8_test)
# Phase 3b T12-T15: the partial-prefix mount (flag-gated longest-LCP fallback when the strict
# mount fails). Exercises `ConversationCache::best_with_partial` and the pure
# `suffix_reuse_partial_apply` helper in suffix_reuse.hpp. Header-only / CPU - no CUDA.
add_executable(suffix_reuse_partial_prefix_test src/program/suffix_reuse_partial_prefix_test.cpp)
target_include_directories(suffix_reuse_partial_prefix_test PRIVATE include)
add_test(NAME suffix_reuse_partial_prefix_test COMMAND suffix_reuse_partial_prefix_test)
endif()
# which path computes the draft layer's prompt K/V, and STRATA_SPLIT_MTP_BATCH's parsing (header-only, CPU)
add_executable(draft_kv_plan_test src/program/draft_kv_plan_test.cpp)
target_include_directories(draft_kv_plan_test PRIVATE include)
Expand Down
35 changes: 35 additions & 0 deletions docs/FW2C_DESIGN_NOTES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# FW-2c design notes — session-local partial K/V splice (drafted 2026-10-13, awaiting review)

## Goal
When a mid-prompt edit finds only a partial (LCP) match, mount the unchanged prefix's K/V directly from the PARKED conversation image instead of re-reading those tokens. Potential (FW-2 survey): 91.2% session-local on deep edits vs 59.7% parked / current state-cadence gap-read.

## Recon facts (verified in source today)
1. `ConversationKvReuse` (conversation_cache.hpp:57) — parking ALREADY retains real K/V:
`kv` (per-layer ConversationKv) + `captured_tokens` / `unchanged_tokens` extents
+ per-stage variants. This is live infrastructure, not new.
2. Park path: `park_current_body` (generate.cpp:7889) captures stage snapshots via
`conversation_snapshot_capture_bytes` with a byte budget; retained K/V must fit it.
3. `best_with_partial` (conversation_cache.hpp:315) returns Match{tokens, partial,
checkpoint_length} — the LCP `P` and anchor depth; FW-2b's two-pool pick feeds
`narrowed_resume_target_state`.
4. Fail-close invariant (T18): gap [anchor, P) must be READ through the normal chunk
loop. FW-2c does NOT touch that — it replaces the *mount source* for [0, anchor)
from "arena re-read" to "parked K/V splice" only when the parked image covers it.

## Design sketch (T24–T26, TDD)
- T24 pure seam (suffix_reuse.hpp): `kv_splice_plan(P, anchor, captured_tokens,
unchanged_tokens, n)` -> {splice_from_parked: [0, min(anchor, unchanged)), read:
[anchor, n), gap: [min(anchor, unchanged), anchor)}; fail-closed default OFF;
env gate `STRATA_SFX_KV_SPLICE=1` for the first probes (same pattern as REPLAY).
- T25 runtime: in the partial-mount branch, if the parked entry's KvReuse covers
[0, anchor): splice K/V into the arena (fp16 path first; int8 needs the Phase-3
dequant->rotate->requant kernels), read [anchor, n) as today. Budget: splice bytes
count against conversation-cache-mib.
- T26 gates: dt-steady chain oracle (160/161/162 must hold), kv-store cert cell,
CUDA parity probe; kill criterion: splice cost > re-read cost at 4096-token depth
(T19 measured piece restarts ~8s — splice must beat that).

## Risks / unknowns
- Int8 splicing kernel reuse from Phase 3 (exists, needs rewiring to park extents).
- Layer-split stages: KvReuse.stages must splice per-stage (park splits images).
- Host RAM: retained K/V already budgeted at park time — splice adds none.
Loading