Repository navigation
Conversation
Bring the earlier Mesh-hosted native/performance work into the standalone source pin while preserving its newer model and runtime contracts. Includes prior work by Jared Wyles and James Dumay plus subsequent native decode, shared verification, and standalone compatibility improvements. Document matched M3 Ultra pilot evidence, remaining recipe certification gates, and the pending vanilla llama.cpp comparison. Dispatch-cache experiments are deliberately excluded from this draft.
Skippy Lab Qualification: PassedCommit: Native Spark lab qualification. Latest successful main: run 46152803372, attempt 1, commit
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. |
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.
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.
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.
|
Ready for review when the running checks land. Current state:
@jaredwy — requesting your review on the retention fix ( |
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
skippy kv-cache status|prune|clearwith owner-mediated administration, mutation confirmation and pinned-entry protection.Usage
Observed locally without loading a model or native runtime:
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:
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 --> gateAfter — 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 --> gateCompatibility
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
AdmittedStageOptionscallers must supplymax_request_tier.Qualification reports use schema 11, contract
behavior_and_reuse_v1, with additive optionalraw_contentdiagnostics alongside parsedcontent. 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-metalandjust 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 --checkandgit 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.job_zbwgs1kh4r7x13g,macmini-764jw9job_4v55y76qzq4yzan,spark-000265job_f00w1mhzz1n80np,macmini-gq7vhwjob_adkpps7yzcvxp0k,spark-000281job_8n4cfyv1r0p7csd,macmini-hk732f(48 GB)job_95ay2txv56ajn8a,spark-000586job_q660acq98ymxb7b,macmini-g2hg9f(48 GB)job_n07b3j9nmt0thyt,spark-000907The 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
0055carries 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_dispatchwithprofile=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.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 recordsbaseline_admission=uncertified_override, so no baseline comparison is reported for that split row. For Qwen3.6 split, both retained leader AgentX profiles loggedInvalidInferenceResultErrorempty-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 nineInvalidInferenceResultErrorresponses 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 intarget/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 downloadtried 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 explicitSKIPPY_CI_MODELsupport.bash -n scripts/ci-model-fetch.sh,git diff --check, andSKIPPY_PYTHON=/tmp/skippy-ci-repair/automation-venv312/bin/python just ci-automationpassed 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-contractsandgit diff --checkpassed on macOS ARM64, including the native-cache regressions. Fresh model/device qualification is pending on the new head.CI repair validation —
f12d963612eda32edbcdb8e5e9fc1aa298d2d19eRefreshed 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 renamedskippy-subprocesspackage.The affected
ci.ymlflow against the target branch, before:After:
The
ci-packagecomposite before:After:
The
ci-smokecomposite before:After:
Local validation:
just --command cargo fmt --all;LLAMA_STAGE_BACKEND=cpu just --command cargo check --workspace --all-targets;LLAMA_STAGE_BACKEND=cpu just lint; andLLAMA_STAGE_BACKEND=cpu just testpassed, including both Rust workspaces, integration/doc tests, harness contracts and native facade tests. Local Cargo runs used the identical prepared parent native tree throughLLAMA_WORKDIR,SKIPPY_LLAMA_DIRandSKIPPY_LLAMA_SOURCE_DIR, with isolatedSKIPPY_LLAMA_BUILD_ROOT/CARGO_TARGET_DIRcaches 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 thepreparingphase 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), andSKIPPY_PYTHON=/tmp/skippy-ci-repair/automation-venv312/bin/python just ci-automationall 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
6fbcd30ba18b3c9837439d8a5a30aa6330132e6bis in this branch's history. The only subsequent changes through320d540d2999d1f1ffea3e49e742db9343e42d1aare 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.6fbcd30bSKIPPY_PYTHON=<python3.12> just inference-contracts,just ci-automationwith the pinned inference publication requirements, andgit diff --checkpassed 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 CIExact-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 (
InteriorReclaimnames 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, andjust testall 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) in1c1998de: the core patch queue is re-exported from the merged native sequence (main's new0063patch retained, the KV stack's patches renumbered0064-0077),native-recipe.jsonregenerated, and the fresh-clone queue replay,just llama-check,just lint, andjust testall pass. CI and Inference qualification on1c1998deare 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