Skip to content

Bound KV cache export and qualify Metal and CUDA - #34

Draft
i386 wants to merge 107 commits into
mainfrom
codex/skippy-kv-qualification
Draft

i386 wants to merge 107 commits into
mainfrom
codex/skippy-kv-qualification

Conversation

@i386

@i386 i386 commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Original problem

KV regressions can return plausible text while recomputing prompts or restoring incompatible state. This PR qualifies correct answers, cache isolation and actual reuse on Metal and CUDA. It also bounds L3 checkpoint copying so it yields to requests and KV eviction can proceed independently.

Tracks #13, #14, and #26.

Diagnostics

The earlier Qwen3.5 0.8B L3 replay on the original Spark saw p95 first-token latency rise from about 3.4 s to 14.5–15.5 s across two matched pairs. Qwen3.8 27B's earlier default served zero cached prompt tokens after its shared RAM budget evicted resident recurrent checkpoints. The newer uncached CI probe also found 811 cached tokens in an 818-token prompt after its server opened the persistent lab cache. L3 benchmark history · CI probe failure

The serving adapter used different cold/cached prefill boundaries and did not consistently translate public structured-output constraints. Attention checkpoints can also retain decoded generated tokens, so accounting based only on the previous prompt undercounts valid reuse. Exact token rankings and score equality across different GPU execution shapes do not establish KV correctness.

Fix

  • Copy resident KV and recurrent state in slices of at most 8 MiB and check for waiting commands between slices. Eviction releases cells directly and invalidates unfinished captures. A spill worker assembles completed slices and publishes the pack.
  • Give the resident recurrent cache a separate 1 GiB default budget and retain the 256 MiB L2 default.
  • Give each inference CI server a fresh disk-cache directory in its job workspace, then remove it after shutdown. Uncached probes keep their zero-cache-hit requirement.
  • Route manual PR-branch inference controllers to GitHub-hosted Ubuntu and verify current PR/collaborator admission, so the main-only Depot policy cannot leave them queued indefinitely.
  • Reuse the split-completion callback socket between sequential qualifications, so a connection in TCP TIME_WAIT does not fail the next job after its quality/streaming checks pass.
  • Align cold/cached prefill and sampling, and honor public structured-output response formats.
  • Reuse Skippy's admitted model identity for cache keys; remove the duplicate content verifier and filesystem/ctime identity layer. Disable durable reuse when required digests are missing.
  • Require known JSON answers, schema/tool/retrieval outcomes, exact request identity and observed L1/L2/L3 restores with avoided prefill. Check conversation growth, template/scope isolation, corruption fallback, ownership and clean/crash restart. Restore hybrid KV and recurrent state together.
  • Validate production-parsed chat content and retain raw decoder text separately. Bound attention reuse by the prompt plus delivered receipt tokens, including a consumed stop token; queued undelivered samples are already excluded. Keep token/score traces diagnostic; an upstream server is optional.
  • Add skippy kv-cache status|prune|clear with owner-mediated administration, mutation confirmation and pinned-entry protection.
  • Verify source, model, executable and report identities and independently recompute report verdicts.

Usage

Observed locally without loading a model or native runtime:

target/debug/skippy kv-cache --kv-cache-disk off status

Representative fields from the JSON response:

{"schema_version":1,"operation":"status","enabled":false,"available":false,"state":"disabled"}

Explicit hardware qualification and retained-report verification use:

just cache-correctness-metal
just cache-correctness-cuda
just cache-correctness-verify metal /absolute/report-directory/result.json

The hardware commands require the pinned model, native build inputs documented in the correctness gate.

Architecture

Selected KV changes run one dense fixture after device smoke inside the existing Metal and ARM64 CUDA 13 package jobs. Full CI runs all four fixtures on each backend using the exact packaged runtime. Models run serially per backend with separate cache roots and pinned Hugging Face revisions. Package qualification does not build a separate upstream server.

Trusted same-repository collaborator PR jobs require source admission, exclusive allocations and cleanup. Untrusted PRs require isolated ephemeral execution. Missing fixtures, devices or required evidence block qualification.

Before — package and device smoke

flowchart TD
    paths["Independent path selection<br/>Main compares against verified covered ancestor"] --> automation["Offline automation"]
    paths --> plan["Plan short or full CI"]
    automation --> quality["Source checks when selected"]
    plan --> metal["Metal package and device smoke"]
    plan --> arm["ARM64 CUDA 13 package and device smoke"]
    quality --> metal
    quality --> arm
    plan -->|"Full profile"| other["Other six package jobs<br/>Shared CPU CLIs and archive checks"]
    plan -->|"Full or selected main native changes"| contracts["Graph Contracts"]
    other -->|"Release: exact archives"| release["Three additional CUDA device smokes<br/>x64 CUDA 12/13 and ARM64 CUDA 12"]
    automation --> gate["CI result gate"]
    metal --> gate
    arm --> gate
    other --> gate
    contracts --> gate
    release --> gate
Loading

After — KV qualification in the same device/package jobs

flowchart TD
    paths["Independent paths plus KV filter<br/>Main keeps verified coverage comparison"] --> automation["Offline automation"]
    paths --> plan["Plan short or full CI"]
    automation --> quality["Source checks when selected"]
    subgraph metalJob["Metal package job - same runner"]
        metal["Build, package, device smoke"] -->|"KV selected: short; full profile: full"| metalKV["KV checks<br/>Short: one dense fixture; full: four fixtures"]
    end
    subgraph armJob["ARM64 CUDA 13 package job - same Spark"]
        arm["Build, package, device smoke"] -->|"KV selected: short; full profile: full"| armKV["KV checks<br/>Short: one dense fixture; full: four fixtures"]
    end
    plan --> metal
    plan --> arm
    quality --> metal
    quality --> arm
    plan -->|"Full profile"| other["Other six package jobs<br/>Shared CPU CLIs and archive checks"]
    plan -->|"Full or selected main native changes"| contracts["Graph Contracts"]
    other -->|"Release: exact archives"| release["Three additional CUDA device smokes<br/>x64 CUDA 12/13 and ARM64 CUDA 12"]
    automation --> gate["CI gate requires selected jobs<br/>Missing or failed KV evidence blocks"]
    metalKV --> gate
    armKV --> gate
    other --> gate
    contracts --> gate
    release --> gate
Loading

Compatibility

Stage protocol generation 18, wire header version 18, and native ABI 0.1.88 apply to the combined changes. Upgrade stage peers together; older peers fail closed. Request tier, private partition, renderer and runtime identity remain part of cache isolation. Rust AdmittedStageOptions callers must supply max_request_tier.

Qualification reports use schema 11, contract behavior_and_reuse_v1, with additive optional raw_content diagnostics alongside parsed content. The verifier rejects reports from a different contract. This gate does not establish native numerical/operator parity.

Validation

KV qualification source: b5224aa34384c2e9e2e07560f69742076191ef2a.

Local checks

Pinned static Metal runtime, Apple M5 Max / 128 GB:

  • just with-lld cargo fmt --all --check — passed.
  • just with-lld cargo check --locked --offline -p skippy-serving -p xtask --all-targets — passed.
  • just with-lld cargo clippy --locked --offline -p skippy-serving -p xtask --all-targets -- -D warnings — passed.
  • just with-lld cargo test --locked --offline -p skippy-serving -p skippy-cache -p xtask -- --test-threads=1 — 1,696 passed, zero failed, 42 opt-in cases ignored in this default suite; integration/documentation tests completed. The accounting regression accepts a consumed stop token and rejects reuse beyond known history.
  • just with-lld cargo test --locked --offline -p skippy-serving --lib frontend::tests::cache_qualification::answer::schema_answer_uses_parsed_content_and_rejects_wrong_values -- --ignored --exact --nocapture, with the pinned dense fixture — passed (1.46 s). Native parsing accepts bare/fenced JSON while the known-answer check rejects the wrong value.
  • just cache-correctness-metal and just cache-correctness-verify metal "$SKIPPY_CACHE_QUAL_REPORT_DIR/result.json", with each matching pinned model/family — all four passed, including independent verification. Full gate times: Qwen3-4B 122.50 s; Qwen3.5-4B 65.73 s; Qwen3-Coder 131.02 s; Qwen3.6 82.92 s.
  • uv run --offline --python 3.12 --with-requirements ci/inference-publish-requirements.txt sh -c 'export SKIPPY_PYTHON="$(command -v python)"; exec just ci-automation' — passed, including 48 Node tests and automation/report contracts.
  • just ci-plan, actionlint .github/workflows/ci.yml, git diff --check and git diff --cached --check — passed.

Latest JY qualification

8/8 passed at b5224aa34384c2e9e2e07560f69742076191ef2a; no failures or pending cells. Every full gate and independent saved-report verifier passed. All jobs succeeded, and retained artifact SHA-256/size, source/node admission, backend/family and schema-11 contract checks passed. Each report contains no validation errors.

Model Metal CUDA 13 ARM64
Qwen3-4B PASS — 242.22 s; verifier 0.03 s. job_zbwgs1kh4r7x13g, macmini-764jw9 PASS — 247.09 s; verifier 0.02 s. job_4v55y76qzq4yzan, spark-000265
Qwen3.5-4B PASS — 65.85 s; verifier 0.03 s. job_f00w1mhzz1n80np, macmini-gq7vhw PASS — 56.11 s; verifier 0.04 s. job_adkpps7yzcvxp0k, spark-000281
Qwen3-Coder-30B-A3B PASS — 228.49 s; verifier 0.02 s. job_8n4cfyv1r0p7csd, macmini-hk732f (48 GB) PASS — 173.78 s; verifier 0.04 s. job_95ay2txv56ajn8a, spark-000586
Qwen3.6-35B-A3B PASS — 210.36 s; verifier 0.02 s. job_q660acq98ymxb7b, macmini-g2hg9f (48 GB) PASS — 84.77 s; verifier 0.02 s. job_n07b3j9nmt0thyt, spark-000907

The gate covers known answers, parsed schema/tool/retrieval behavior, model/renderer/scope isolation, observed L1/L2/L3 reuse and suffix accounting, restart, ownership and corruption fallback. Raw text/token/score traces remain retained diagnostics.

All eight jobs ran in parallel on idle, unreserved machines. CUDA used ARM64 GB10 Sparks with compiler 13.0.88; both large Metal fixtures used 48 GB Macs. These are source-built native qualifications. Official packaged-runtime certification and full Graph Contracts were not rerun locally. No preparation, verification, artifact-integrity or cleanup failure was reported.

Retained local evidence: target/kv-harness-fix/; verified JY artifacts and final matrix: target/kv-harness-fix/jy/. Monitoring is complete.

Native KV restore preclear

Patch 0055 carries the same change and regression test as PR #179. Raw L2 and L3 restores skip the clear for reclaimed chunks whose cache tensor rows the import completely overwrites. OS page-reuse advice still runs and partially covered chunks still clear.

The focused native CPU fixture passed on this PR head. It checked the remaining clear size after importing two complete chunks and a partial chunk, verified the exported KV bytes, and compared continuation logits exactly.

In the isolated Metal rebench of this native change on an M5 Max, Coder 30B cleared 522 → 6 MiB on the L2 return and native import fell from 59.6 to 51.9 ms. Median end-to-end L2 TTFT rose from 209 to 235 ms across four pairs. Qwen3.5 0.8B L2 TTFT fell from 53 to 47 ms across two pairs. All 60 requests matched output between builds. The local replay used the same development Skippy binary in both arms. Exact-head hardware qualification is pending. Isolated change and benchmark details

Inference qualification

Source for the workflow results below: 478aa964f70012bd00f80286998b130e8cc3a1ce.

Full nightly profile: workflow run 45017509730, workflow_dispatch with profile=nightly. Exact-source plan/admission passed. Workflow completed with overall failure: 3 configurations qualified; 9 failed or incomplete; 0 running; 0 queued. JY AgentX profiles are read-only; collected profile artifacts were verified against JY SHA-256 and byte-size descriptors.

Configuration Output tok/s (baseline; change) TTFT p95 ms (baseline; change) ITL p95 ms (baseline; change) Qualification
Qwen3.5-0.8B standalone 37.85 (48.07; −21.27%) 22,944.58 (3,017.80; +660.31%) 44.62 (8.74; +410.52%) JY PASS; 120 requests, 0% errors; all three regress beyond 1%
Qwen3.5-2B standalone 29.16 (45.31; −35.63%) 23,462.83 (5,284.67; +343.98%) 54.52 (12.02; +353.54%) JY PASS; 111 requests, 0% errors; all three regress beyond 1%
Qwen3.5-4B standalone 18.90 (29.48; −35.89%) 25,571.53 (14,103.23; +81.32%) 27.57 (24.46; +12.71%) FAILED cleanup; 78 requests, 0% errors; diagnostic only
Qwen3.5-9B standalone 14.01 (20.18; −30.54%) 43,872.81 (18,175.82; +141.38%) 62.66 (35.64; +75.81%) FAILED cleanup; 61 requests, 0% errors; diagnostic only
Qwen3.8-27B standalone 3.68 (6.80; −45.91%) 135,440.20 (57,205.10; +136.76%) 97.85 (100.54; −2.68%) INCOMPLETE; profiling timed out with one request cancelled, then cleanup failed; diagnostic only
Qwen3.8-27B split 2.37 (baseline unavailable) 149,982.13 (baseline unavailable) 204.48 (baseline unavailable) INCOMPLETE; one profiling request cancelled and the worker could not connect to the leader completion endpoint on port 9912; formation failed
Qwen3.8-Flash-Next standalone 6.57 (14.97; −56.15%) 72,578.30 (48,374.33; +50.03%) 41.16 (39.14; +5.16%) FAILED cleanup; two valid AgentX profiles, 34 requests, 0% errors; 900-second cap then forced shutdown; diagnostic only; all three comparable metrics regress beyond 1%
Qwen3.8-Flash-Next split 8.28 (baseline unavailable) 103,780.83 (baseline unavailable) 44.06 (baseline unavailable) FAILED formation; leader profiles only, 42 requests, 0% errors; worker could not reach the leader on port 9912; diagnostic only; admission audit blocks baseline comparison
Qwen3.6-35B-A3B standalone 17.24 (27.49; −37.28%) 44,135.61 (21,442.46; +105.83%) 46.36 (21.89; +111.78%) INCOMPLETE; 67 requests, 0% errors; 900-second profiling cap triggered, then cleanup failed; diagnostic only
Qwen3.6-35B-A3B split Unavailable Unavailable Unavailable FAILED AgentX validation; leader profiles contain empty-content errors; worker could not reach leader completion endpoint on port 9912; formation failed
Qwen3-Coder-30B-A3B standalone 19.21 (20.45; −6.09%) 28,996.63 (27,477.26; +5.53%) 38.35 (38.86; −1.31%) JY PASS; 80 requests, 0% errors; throughput and TTFT regress beyond 1%, ITL improves 1.31%
Qwen3-Coder-30B-A3B split Unavailable Unavailable Unavailable FAILED AgentX validation; 9 empty-content errors in one trial (42.86% error rate); no valid metric pair; worker cancelled

The 4B, 9B, 27B standalone, 3.6-35B standalone, and Flash standalone jobs failed teardown with child process group required forced shutdown; their measurements do not count as qualification. For the 27B split, the leader produced profiles but its 930-second profiling phase cancelled one request; the worker then logged repeated connection failures to the leader's completion endpoint, and the two-member formation failed. Its pinned baseline audit records baseline_admission=uncertified_override, so no baseline comparison is reported for that split row. For Qwen3.6 split, both retained leader AgentX profiles logged InvalidInferenceResultError empty-content responses; the worker repeatedly failed to connect to the leader completion endpoint on port 9912, and the formation failed. The Flash split leader retained two valid profiles (42 requests, 0% errors), but its worker repeatedly failed to connect to port 9912 and the formation failed; the pinned split baseline also has uncertified admission, so its leader-only metrics are diagnostic and have no baseline verdict. For Coder split, the leader's second AgentX trial logged nine InvalidInferenceResultError responses with no content (9 errors among 21 requests); the leader rejected the failed AgentX evidence and the worker was cancelled after formation failure.

The reference is the pinned HF baseline snapshot, latest baseline source d3d9bd694084d2d3f397aa77bf03cbfc9625a840. Exact contract compatibility is zero. Eight rows have a documented per-row semantic audit confirming matching model inputs, measurement formulas, workload driver, reproduced published contract, and no uncertified admission override. Their contract hashes and source-bound data are retained in target/inference-pr34/github/full-nightly-partial-comparisons.json; no HF baseline was updated or promoted. On these eight comparable rows, throughput and TTFT regress beyond 1%. ITL regresses beyond 1% on the 0.8B, 2B, 4B, 9B, 3.6-35B, and Flash standalone rows; it improves on 27B standalone and Coder standalone. The 27B, 3.6-35B, and Flash standalone measurements are diagnostic because the workloads or cleanup were incomplete.

Other latest source-bound checks: PR smoke run 45012424426 failed in the JY controller on HTTP 500s; retained Qwen3.6 split quality/streaming smoke passed but is not an extended performance result. CI run 45012424542 passed automation, target validation, and Quality canary. Metal stopped at JY setup with an internal API error; CUDA build/package passed, then model preparation failed with a Hugging Face cache PermissionError, so neither device qualification ran.

CI repair validation

The CUDA package job failed while hf download tried to create /home/runner/.cache/huggingface. Ported main’s immutable-fixture downloader: it uses checkout-local scratch space, verifies size and SHA-256 before the atomic rename, and retains explicit SKIPPY_CI_MODEL support. bash -n scripts/ci-model-fetch.sh, git diff --check, and SKIPPY_PYTHON=/tmp/skippy-ci-repair/automation-venv312/bin/python just ci-automation passed on macOS ARM64. The initial automation run failed because the local interpreter lacked pyarrow; the explicit Python 3.12 reporting environment passed. CUDA/Metal package qualification is pending in CI.

Native cache validation

The v1 shared Cargo/sccache inputs omitted the native patch recipe, allowing native artifacts from another source tree to be reused. Ported main’s source-bound dependency/extra-file identity and cold-build directory fix. Native patch edits/removals now invalidate dependency caches; Rust-only changes retain their permitted dependency reuse.

SKIPPY_PYTHON=/tmp/skippy-ci-repair/automation-venv312/bin/python just automation-contracts and git diff --check passed on macOS ARM64, including the native-cache regressions. Fresh model/device qualification is pending on the new head.

CI repair validation — f12d963612eda32edbcdb8e5e9fc1aa298d2d19e

Refreshed the KV stack through #113/#9 and main cc2a27435e798649a9cb938d600d39722e4a2263, incorporating separate qualification queue/execution budgets, formation-bound peer checks, cold-runner patch replay and single-count decode accounting. Native ABI 0.1.90, generated bindings, API reference and source-recipe identity agree. Runtime archives must be rebuilt for this recipe. The existing KV wire/hash contracts are preserved.

Moved the KV integration onto the current shared native package lanes: Metal and Linux ARM64 CUDA 13 each run short KV checks after exact-archive device smoke for selected PR packages, and the full four-fixture checks for full CI. The package path filter includes tools/xtask/** and the KV action. Removed the obsolete separate ARM64 archive/device handoff and retained main's product artifact names, Windows/Vulkan flows and protected fork admission. Retained the admitted model identity used for KV tiers and removed the duplicate KV-clear patch because main already contains the identical patch (matching stable patch ID). Updated the harness dependency mapping for the renamed skippy-subprocess package.

The affected ci.yml flow against the target branch, before:

flowchart LR
  T[Protected PR / main / nightly / release call] --> A[Offline automation]
  A --> Q[Quality canary when code applies]
  Q --> H[Full: verified platform CLI producers]
  Q --> P[Selected Metal and ARM64 CUDA 13 packages]
  H -->|Verified host CLI artifact| P
  P --> D[Exact-archive device smoke]
  D --> E[Tested products and device evidence]
  E --> G[CI aggregate]
Loading

After:

flowchart LR
  T[Protected PR / main / nightly / release call] --> A[Offline automation]
  A --> Q[Quality canary when code applies]
  Q --> H[Full: verified platform CLI producers]
  Q --> P[Selected Metal and ARM64 CUDA 13 packages]
  H -->|Verified host CLI artifact| P
  P --> D[Exact-archive device smoke]
  D --> K[KV: short on PR packages / four fixtures on full CI]
  K --> E[Tested products and device plus KV evidence]
  E --> G[CI aggregate requires package success after KV]
Loading

The ci-package composite before:

flowchart LR
  C[Build or restore verified CLI] --> B[Build runtime and assemble archive]
  B -->|Inference mode| S[ci-smoke]
  B -->|Artifact mode| V[Archive smoke]
  S --> U[Upload tested product]
  V --> U
Loading

After:

flowchart LR
  C[Build or restore verified CLI] --> B[Build runtime and assemble archive]
  B -->|Inference mode| S[ci-smoke receives KV profile]
  B -->|Artifact mode| V[Archive smoke]
  S -->|Profile present| K[Exact-package KV result]
  S -->|Empty profile| U[Upload tested product]
  K --> U
  V --> U
Loading

The ci-smoke composite before:

flowchart LR
  P[Product directory or restored product] --> F[Admit pinned fixture]
  F --> D[Device inference smoke]
  D --> E[Device evidence]
Loading

After:

flowchart LR
  P[Product directory or restored product] --> F[Admit pinned fixture]
  F --> D[Device inference smoke]
  D -->|Profile present| K[Native KV qualification]
  D -->|Empty profile| E[Device and independent KV evidence]
  K --> E
Loading

Local validation: just --command cargo fmt --all; LLAMA_STAGE_BACKEND=cpu just --command cargo check --workspace --all-targets; LLAMA_STAGE_BACKEND=cpu just lint; and LLAMA_STAGE_BACKEND=cpu just test passed, including both Rust workspaces, integration/doc tests, harness contracts and native facade tests. Local Cargo runs used the identical prepared parent native tree through LLAMA_WORKDIR, SKIPPY_LLAMA_DIR and SKIPPY_LLAMA_SOURCE_DIR, with isolated SKIPPY_LLAMA_BUILD_ROOT/CARGO_TARGET_DIR caches and serialized Cargo sequences. The final shared native queue also passed cold text-only replay and its focused async-state contracts.

SKIPPY_PYTHON=/tmp/skippy-ci-repair/automation-venv312/bin/python just ci-automation, generated API documentation check, git diff --check, and all-workflow actionlint passed. Local actionlint 1.7.12 required narrow compatibility exceptions for documented GitHub cache-mode and queue: max keys; repository lint rules were retained.

Fresh exact-head CI and real-model/GPU KV qualification remain pending. These local software/synthetic checks do not establish a hardware or performance claim. Existing measured results apply to their recorded commits. Contributor declarations remain unchanged.

Split preparation rendezvous repair

The follow-up to main's peer lifecycle improvements is included at 9ca2d80147477837c7e1e6301c3ff5bc0ef31047. The failed #239 split attempt showed a late-starting peer remained invisible during model admission and stage planning. Control now exposes the matching formation/source/attempt in the preparing phase during those operations. Native-child readiness, listener ownership and completion evidence remain required; timeouts and qualification policy are unchanged.

Validation for this head: git diff --check, just --command env PYTHONPATH=scripts /tmp/skippy-ci-repair/automation-venv312/bin/python scripts/tests/inference_peer.py (12 tests), and SKIPPY_PYTHON=/tmp/skippy-ci-repair/automation-venv312/bin/python just ci-automation all passed. The new real-loopback regression covers both roles and both preparation operations, rejects premature readiness, and verifies cleanup on preparation failure. Exact-head hardware qualification is pending CI.

Consolidated L3 qualification

PR #185's qualified runtime commit 6fbcd30ba18b3c9837439d8a5a30aa6330132e6b is in this branch's history. The only subsequent changes through 320d540d2999d1f1ffea3e49e742db9343e42d1a are the inference harness's per-run cache directory and its regression test. The runtime uses native ABI 0.1.95 and split protocol generation 19. Rebuild and deploy the runtime to all split workers together. The L3 pack format and prefix key algorithm are unchanged. An ABI change causes old checkpoints to be bypassed and refilled.

Check at 6fbcd30b Result
Original Mac no-gap replay 12/12 L3 restart hits and 60/60 matching outputs and token counts
Hardware cache gates 8/8 passed across Metal and CUDA on lab machines
Qwen3.5 0.8B on original Spark Four 900-second AgentX trials. L3 reduced mean trial p95 TTFT from 3.281 s to 2.527 s (−22.98%) and raised throughput across 148 matched pairs from 117.82 to 119.04 tok/s (+1.03%). P95 inter-token latency rose 1.66%. Both specified 1% gates passed.
Qwen3.8 27B on original Spark Two 900-second trials with L2 and L3 active. Each served 627,083 cached prompt tokens across 12 resident L1 hits.
Longer Qwen3-Coder replay Five matching turns wrote 1.97 GiB of pack payload. The final 8,203-token checkpoint occupied 769 MiB and appeared about 1.10 s after the response.
Scheduler and native validation The queued-request regression passed, as did the 4,978-test linked suite and 11 selected native tests.
Shared packages and split smoke Official Metal and CUDA package jobs passed and Qwen3.6 split smoke passed across all 40 layers.

SKIPPY_PYTHON=<python3.12> just inference-contracts, just ci-automation with the pinned inference publication requirements, and git diff --check passed for the CI isolation change. Exact-head inference qualification passed all seven configurations, including Qwen3.6 split. The two formerly failing standalone jobs opened empty per-run L3 directories and their six probe requests per model all reported zero cached tokens. Shared build and package CI is running. The isolated state regression covers two invocations and verifies the cache stays available until server shutdown and is removed afterward. Full L3 evidence · Package CI · Inference CI

Exact-state branch-point retention fix (7e880634)

The same-Spark Flash Next investigation found why the standalone and split AgentX comparisons regressed: exact-state eviction preferred superseded checkpoints unconditionally. The attention-derived soft cap sits below one indivisible Flash Next snapshot (~1.6-1.8 GiB), so the soft pass ran on every insert and evicted the shared-prefix checkpoint the moment its own conversation extended past it. Sibling AgentX branches that diverge at that prefix then lost their only reusable entry and re-prefilled ~48k tokens: main kept 8/13 radix hits on the replay, the previous head kept 4 with L1 only and 0 with L3 enabled, median prefill on the lost turns rose from 4.0 s to 71.6 s, and the mixed-load comparison lost 65% of output throughput. Eviction now follows use: the soft pass stops at the retention floor, the entry-count loop evicts the coldest entry, and only the hard byte ceiling may reclaim superseded checkpoints ahead of recency (InteriorReclaim names the policy). Long single-conversation catalogs stay bounded through the hard pass and the entry limit.

Validation on 7e880634: cargo fmt --all --check, cargo check -p skippy-serving, cargo clippy -p skippy-serving --all-targets -- -D warnings, cargo test -p skippy-serving (lib, integration, and doc targets), just lint, and just test all passed. Three retention tests cover the branched shapes; one existing test's payload data was corrected because a u8 wraparound made its fifth snapshot byte-identical to the first, silently removing the byte pressure it meant to create. A four-arm same-Spark replay (main vs this head, L1-only and L1+L3) is queued to verify the radix hits recover; the Flash Next qualification matrix re-run and the mixed-load AgentX comparison follow once it confirms. The four-arm verification replay on the same Spark (spark-001095, zero-cost job) confirms the fix: the fixed build now matches main's 8/13 radix hits in both cache modes with zero lost hits on matched requests (the previous head lost 4 with L1 only and 8 with L3), TTFT p50 drops from 16.24 s to 5.15 s (L1) and 70.92 s to 5.36 s (L1+L3), and the fixed arms retain fresher checkpoints than main (399,011 cached tokens to main's ~389,000). Every arm, including the reference arms that earlier diagnostic runs had to force-stop, shut down cleanly.

Fixed-head re-measurement (7e880634)

The two regressed Flash Next rows and the Coder cold-miss cohort are being re-measured on the retention-fix head, same paired protocol and main baseline (7e252611) as the original table. Qwen3-Coder standalone is re-verified: AgentX 19.17 → 20.51 tok/s (+7.0%, was +6.8%), TTFT p50 −14.7%, zero errors, no hit-to-miss cohorts. The L3 restart cohort doubled throughput (28.8 → 62.4 tok/s, 8/48 → 48/48 hits); the L3 cold-miss decode stalls persist (ITL p95 95 ms, 29/48 requests) and remain the documented open tradeoff — main's own L3 cold arm also costs 33% throughput against its L1 baseline. The branch also absorbed main's llama.cpp upstream bump (09c14106 → 918fe468) in 1c1998de: the core patch queue is re-exported from the merged native sequence (main's new 0063 patch retained, the KV stack's patches renumbered 0064-0077), native-recipe.json regenerated, and the fresh-clone queue replay, just llama-check, just lint, and just test all pass. CI and Inference qualification on 1c1998de are running. Flash Next standalone is re-verified: AgentX 13.51 → 15.11 output tok/s (+11.8%, was −65.3%), TTFT p95 −34.5%, zero errors, no hit-to-miss cohorts. Synthetic cohorts confirm the reuse story: repeat 25.48 → 27.09 tok/s with the fixed build retaining fresher checkpoints (87,264 vs 80,004 cached tokens), restart throughput 13.11 → 24.64 tok/s (+88%) with restart TTFT p50 2,630 → 374 ms, and cold-miss parity (no stall cohort on this model). Flash Next split still regresses on the fixed head: 10.47 → 5.09 output tok/s (−51.4%) — the retention fix cured the standalone path but not the split pipeline. The split row's synthetic cohorts are healthy on the fixed build (repeat 48/48 hits, restart 48/48 hits with +61% throughput over main), so the loss is specific to the AgentX continuation turns, which need the post-decode checkpoints the split pipeline appears not to publish or see. A traced split-mode replay (leader + worker, telemetry on, current merged head vs current main) is running to identify the miss reason; the split row's final verdict follows its fix. The Coder and Flash Next standalone rows above are unaffected.

Acceptance criteria

  • I ran the relevant local checks, or explained why they do not apply.
  • I agree to license my contributions under the Apache License, Version 2.0.

@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Skippy Lab Qualification: Passed

Commit: 1c1998de78b41d0c31124c9a2244f62bb2e87e13 · PR smoke · Workflow and timings · Saved evidence

Native Spark lab qualification.

Latest successful main: run 46152803372, attempt 1, commit b22fd13ad71717ac42001899de1354b355960291. Comparison unavailable: workload inputs changed or could not be verified.

Configuration Outcome Prefill tok/s Prefill vs main Decode tok/s Decode vs main Actions logs
qwen35-4b-standalone Passed 3755.7 Unavailable 61.3 Unavailable Logs
qwen3-coder-30b-a3b-standalone Passed 2926.6 Unavailable 70.3 Unavailable Logs
qwen3-coder-30b-a3b-split Passed 2035.0 Unavailable 55.5 Unavailable Logs
qwen36-35b-a3b-standalone Passed 1972.3 Unavailable 62.3 Unavailable Logs
qwen36-35b-a3b-split Passed 1889.4 Unavailable 41.1 Unavailable Logs
qwen38-flash-next-standalone Passed 689.3 Unavailable 25.6 Unavailable Logs
qwen38-flash-next-split Passed 539.5 Unavailable 26.0 Unavailable Logs

TPS comes from three separate warmed, uncached probes at concurrency 1, each generating exactly 128 tokens. The scored correctness answers and each probe's 64-token warmup are excluded. Each rate is total tokens / total server-reported phase time, not an average of request rates. Client elapsed times and raw responses are retained in throughput-probe.json. These bounded samples are not sustained benchmarks or controlled speedup comparisons. Legacy short-answer receipts and missing or invalid probe evidence show as Unavailable.

Deltas use unrounded rates from matching PR-profile smoke receipts on the latest successful main run, including the nightly smoke evidence. Positive means faster. Changed workload inputs, different serving host classes, unequal phase token counts or missing evidence show Unavailable. Physical Spark placement and runtime conditions can differ; deltas are descriptive, not controlled speedup claims.

Smoke checks cover GPU startup, deterministic endpoint repeats and bounded streaming. They do not establish an AgentX performance score. Nightly history and saved performance baselines are published separately; a saved baseline can be older than the latest successful main run used here. Native build and qualification output streams into each configuration’s Actions log, with per-attempt copies in Saved evidence. Any capture gaps are reported in the log and saved diagnostics. GitHub evidence copies expire after 30 days.

danielwinterw
danielwinterw previously approved these changes Nov 18, 2026
@i386
i386 added this pull request to stack #99 November 20, 2026 20:51
i386 added 2 commits November 21, 2026 10:38
Keep the placement and batching baseline from Skippy #71 and replay the nine remaining native patches against it. Integrate shared draft and verification scheduling while preserving the main branch's cache, stop-token, and GGUF admission behavior. Bump the ABI for the shared verify export.
Standalone main added the analytics command map without the existing GPU benchmark variant. Include its event family so the branch builds directly against main. This also matches the independent fix in Skippy #106.
i386 added 25 commits November 28, 2026 18:39
@i386 i386 changed the title Gate KV cache correctness on Metal and CUDA Bound KV cache export and qualify Metal and CUDA Nov 29, 2026
The attention-derived soft cap sits below one indivisible snapshot, so the
soft pass ran on every insert and evicted superseded checkpoints
unconditionally; the entry-count loop preferred them too. That dropped the
shared-prefix checkpoint the moment its own conversation extended past it,
so sibling branches that diverge at that prefix lost their only reusable
entry and re-prefilled the whole shared context. On the Flash Next AgentX
replay main kept 8 of 13 radix hits while the PR kept 0-4; the lost turns
re-prefilled ~48k tokens (TTFT 4 s -> 72 s) and the mixed-load comparison
lost 65% of output throughput.

Eviction now follows use. The soft pass stops at the retention floor
instead of reading a cap it structurally cannot satisfy as pressure, the
entry-count loop evicts the coldest entry, and only the hard byte ceiling
may reclaim superseded checkpoints ahead of recency. InteriorReclaim names
that policy at the call site, and the retention tests cover the branched
shapes that the superseded preference got wrong. The hard pass keeps
reclaiming superseded interiors under a real ceiling, so long
single-conversation catalogs stay bounded.
@i386
i386 marked this pull request as draft December 1, 2026 03:50
Absorbs main's llama.cpp upstream bump (09c14106 -> 918fe468) and its
queue changes. The core queue is re-exported from the merged native
sequence: main's new 0063-graph-preserve-lora patch is retained and the
KV stack's patches renumber 0064-0077, with the branch's native deltas
folded onto the new upstream via a three-way carry. native-recipe.json
is regenerated from the resulting queue. scripts/inference-execute.py
keeps main's diagnostics placement and the branch's per-run L3 cache
directory.

Validation on the merged tree: fresh-clone llama-prepare cold replay of
the whole queue, just llama-check, just lint, and just test all pass.
@i386

i386 commented Dec 1, 2026

Copy link
Copy Markdown
Contributor Author

Ready for review when the running checks land. Current state:

  • Flash Next cache regression root-caused and fixed (7e880634): superseded-first eviction was dropping the shared-prefix checkpoints that sibling AgentX branches reuse. Eviction now follows use; the same-Spark four-arm replay shows 8/13 radix hits in both cache modes (was 0-4), no lost hits versus main, and clean shutdowns in every arm.
  • Coder standalone re-measured on the fixed head: AgentX 19.17 → 20.51 tok/s (+7.0%), L3 restart reuse 8/48 → 48/48 hits (+116% restart throughput); the L3 cold-miss decode stalls remain the documented open tradeoff.
  • 1c1998de absorbs main (llama upstream 09c14106 → 918fe468): the core patch queue is re-exported from the merged native sequence, native-recipe.json regenerated; fresh-clone queue replay, just llama-check, just lint, and just test pass locally. CI and Inference qualification on 1c1998de are running.
  • The two Flash Next mixed-load rows are re-measuring on the fixed head now and will update the comparison table.

@jaredwy — requesting your review on the retention fix (crates/skippy-serving/src/kv_integration/config/exact_state_retention.rs, the InteriorReclaim policy) and the queue re-export (llama_cpp/patches/, native-recipe.json).

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

qualify Run real-model inference qualification for this pull request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants