Commit Graph
365 Commits
Author SHA1 Message Date
Pavlo RatushnyiandClaude Opus 5.5 c9845eed52 fix(experts): split bank copies at page-locked boundaries; Original bench without the subcommand
With part of a file-mapped bank page-locked (`pin_resident`), an H2D copy that starts in registered pages and
runs into unregistered ones is refused by the driver (CUDA_ERROR_INVALID_VALUE, first seen on the laptop run).
`MappedExpertBank::copy_pieces` cuts a `cache_source` slice at every registered boundary and the four copy
sites (prompt copy ring, cache fill, swap fill, PCIe staging) issue one copy per piece; one piece when nothing
is locked, so the default path is unchanged. original_bench.sh: the `strata` binary takes the generate
options directly.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 12:49:53 +02:00
Pavlo RatushnyiandClaude Opus 5.5 1ef80a1fb0 bench(laptop): optional smaller process geometry (LELEKA_LAPTOP_CELLS, experimental)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 11:39:05 +02:00
Pavlo RatushnyiandClaude Opus 5.5 150561bd07 feat(experts): resident RAM budget over the mapped bank (--resident-budget-gib)
`LELEKA_ORIGINAL_SERVE_RESIDENT_BUDGET_GIB=N` (VRAM tier on, low-RAM file-mapped bank): after the cache is
filled from the profile, the experts it does not hold are page-locked in RAM in profile order while their
gate/up/down bytes fit N GiB, clamped like FileExpertSource::pin_cache_complement to MemAvailable less the
4 GiB headroom and a 0.25 GiB margin. The Original copies them into a page-locked arena; here the bank's own
file pages are registered read-only in place (`MappedExpertBank::pin_resident`, merged page ranges per
mapping, CU_MEMHOSTREGISTER_READ_ONLY), so they are read once, stay out of reclaim, and their copies are
DMA. The bytes are unchanged. A budget that cannot be kept is a warning (#403) and leaves nothing registered.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 11:37:19 +02:00
Pavlo RatushnyiandClaude Opus 5.5 bbba0f231d bench(laptop): paired Original/port harness on fixed pre-tokenized prompts
* tokenizer example `chat_tokens`: one user turn per line, thinking off, to comma-separated IDs, so both
  engines get exactly the same token IDs (benchmarks/laptop/prompts.txt: 3 prompts, 78-88 tokens).
* leleka-runtime ignored test `original_serve_laptop_bench`: opens the Original serve stack with the
  low-RAM sources (mapped experts, read-only KAR file; resident/memfd still selectable), serves every prompt
  REPEAT times greedily and prints TTFT, prompt/decode phase times, prefill/decode tok/s, memory and the
  output IDs of the first pass.
* scripts/laptop: original_bench.sh drives the unmodified `strata generate --serve` (setup.py's IQ3_S
  arguments, conversation cache off, one GEN at a time, TTFT to the first T line); port_bench.sh runs the
  test; monitor.sh samples process RSS/anon/file/shmem/locked/pinned and GPU VRAM once a second.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 11:27:46 +02:00
Pavlo RatushnyiandClaude Opus 5.5 2bd2c147f9 feat(kar): admit the pinned KAR archive as a read-only file instead of a 55 GB sealed memfd
`InheritedKarArchive::open_read_only_file`: the archive stays on the SSD and only the PLE rows a request
reads pass through the OS file cache, like the Original's PleTable::open_kar (kar_open with payload
verification, then a read-only mapping of the file). The sealed memfd keeps 55,295,529,472 bytes of shmem
for the life of the process. Full SHA-256 and payload CRCs are still verified at load; immutability
afterwards is the operator's (regular file, one link, owned by this user, no write bits), and the reader
is reopened through /proc/self/fd with the inode rechecked.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 11:27:08 +02:00
Pavlo RatushnyiandClaude Opus 5.5 6c208972ba feat(experts): low-RAM mapped expert source (the Original's --mmap-experts, GGUF in place)
The serve stack's routed experts came only from `load_resident_expert_source`, a 50 GB RAM copy of the
144 shard-0 banks that `MappedExpertBank` then page-locks whole: impossible on a 32-48 GB PC.

* model-format: `ResidentTensor` storage is an owned copy or a read-only MAP_SHARED mapping of the verified
  shard (`VerifiedGgufFile::map_resident_tensor`, same descriptor, bounds and size checks);
  `Qwen4ExpArtifact::load_mapped_expert_source` builds the same bank catalog from mappings, no RAM
  admission (generate.cpp `src.set_gguf` + `FileExpertSource::open`). The crate's lint is relaxed from
  forbid to deny so exactly this mapping owner can allow its mmap/munmap/slice.
* cuda-driver: a lease of mapped banks makes `MappedExpertBank` pageable: no cuMemHostRegister; every
  consumer the Original serve stack uses (`cache_source` for the prompt copy ring, VRAM tier fills/swaps,
  PCIe staging) copies with cuMemcpyHtoDAsync from pageable memory; the zero-copy device aliases
  (`retained_span_handle`, `copy_triplet`) are refused.
* runtime: `ModelBinding::load_mapped_expert_source`.

The bytes are the file's, so consumers see what the resident copy holds. Unit test
`mapped_tensor_is_the_files_bytes_and_a_retained_owner`; model-format --lib 128 passed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 11:27:08 +02:00
Pavlo RatushnyiandClaude Opus 5.5 d82fee8bcd fix(sm86): regenerate the qsa_prompt_resolver companion after the kv-streaming reseal
The kv-streaming merge resealed crates/cuda-driver/src/qsa_prompt_resolver.ptx (0103ee9) after the sm_86
companion set was generated, so the table had no key for the new sm_120 body: the two arch_ptx unit tests
failed and the 3080 would have been handed the sm_120 image for the streamed-KV resolver.
`sm86_assets.py build` (CUDA 13.2.86) changes only that companion, MANIFEST.json and sm86_table.rs;
`sm86_assets.py check` OK (127 companions); leleka-cuda-driver --lib --features cuda-driver,sm86: 349 passed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 11:26:56 +02:00
Pavlo RatushnyiandClaude Opus 5.5 656925ec86 merge: claude/expert-residency (88baa91, VRAM expert tier) into the bring-up branch
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 11:06:40 +02:00
Pavlo RatushnyiandClaude Opus 5.5 88baa91c2f merge: claude/port-gpu-bringup (kv streaming, conversation cache, sm86) into claude/expert-residency
The stack keeps every behaviour: KV format/resident config, conversation resume
with periodic/turn/root checkpoints after each published chunk, and the expert
tier. prefill_phase waits the swaps in flight, runs the conversation-aware
chunk loop (prefill_actions), and refills every lent slot on every exit path;
prefill_chunk borrows the cache's last slots for that chunk only (so the
conversation checkpoints between chunks see the whole stack) or uses the
stack's own buffers. Backend wiring keeps kv/kv_resident/conversation and the
expert tier; the driver keeps the sm86 and expert-tier-probe features; the
smoke keeps the LELEKA_SMOKE_REPEAT timing loop and adds the tier report.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 11:04:46 +02:00
Pavlo RatushnyiandClaude Opus 5.5 527358d0fb diag(serve): time every OriginalServePort call under LELEKA_BRINGUP_TRACE
TracePort now reports the wall time of each port call (validate/checkpoint/run_window/commit/draft/wait/drain...) so a traced
real-model run shows where a decode round spends its time. Prints nothing unless LELEKA_BRINGUP_TRACE is set.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 11:01:24 +02:00
Pavlo RatushnyiandClaude Opus 5.5 9ea8e88529 merge: claude/conversation-cache into the bring-up branch (with claude/kv-streaming)
Conflicts resolved by keeping both features: StackConfig/OriginalServeOptions carry kv_format/kv_resident and the
conversation config; leleka-inference accepts --kv/--kv-resident and --prompt-cache/--prompt-cache-every/
--prompt-cache-root/--turn-token (fixed a lost offset increment after --kv-resident in the merged parser); the smoke file keeps
both the long-context KV test and the conversation-cache test; the ensure_resolver test follows the 5-tuple
window_kv_addresses of the KV branch. Workspace type-checks (WSL, --all-targets).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 10:58:39 +02:00
Pavlo RatushnyiandClaude Opus 5.5 2262072206 merge: claude/kv-streaming into the bring-up branch
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 10:56:28 +02:00
Pavlo RatushnyiandClaude Opus 5.5 d064b9d89e docs: the Original serve stack's VRAM expert tier, switches, deviations and proofs
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 10:54:46 +02:00
Pavlo RatushnyiandClaude Opus 5.5 6917f7c704 chore(bring-up): register the KV GPU proofs in the qsa smoke group and regenerate the smoke table
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 10:54:29 +02:00
Pavlo RatushnyiandClaude Opus 5.5 a9b5fd4df0 test(serve): real-model conversation smoke; docs for the conversation cache
original_serve_conversation_smoke (ignored, real model): a one-token first request,
chat A, chat B = A + reply + a new turn resumed from the cache vs the same B read
from 0 (equal greedy tokens asserted, TTFT printed), then a new chat sharing the
system prompt (root checkpoint). docs/original-serve.md describes the cache, its
limits (no parking, live continuation only with the ring in step) and the run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 10:54:20 +02:00
Pavlo RatushnyiandClaude Opus 5.5 b494984555 test(serve): the smoke reports, not asserts, repeat determinism with the expert tier on
Adaptive swaps change which experts the GPU computes between requests and the
two paths round differently; tier-off runs keep the exact assertions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 10:53:58 +02:00
Pavlo RatushnyiandClaude Opus 5.5 8f4a45dba9 test(serve): model-free device proof of the VRAM expert tier
Synthetic IQ4_XS/IQ4_NL experts in a six-slot cache, one verify-window layer
group through OriginalExpertTierProbe: the resident experts' entries become
VRAM groups in routing order, every CPU entry is bit-identical to the all-CPU
run, GPU entries are within the Original's 3e-2 relative L1 of the CPU path,
and a plan naming another expert's slot is refused. RTX 5090: passed, worst
GPU-vs-CPU relative L1 1.155e-2.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 10:51:18 +02:00
Pavlo RatushnyiandClaude Opus 5.5 6bfb44fab9 docs(kv): KV storage and streaming port, selection, proofs and the long-context job
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 10:50:59 +02:00
Pavlo RatushnyiandClaude Opus 5.5 6f6e72a651 feat(serve): VRAM expert tier for the Original serve stack (R4 residency, PCIe share, adaptive swaps, prompt loan)
StackConfig::expert_tier (default off) opens the Original expert cache after
every other owner (literal auto/explicit sizing, profile-sized slots, retry),
fills it from the STRP profile through the registered model bank and reads
slot 0 back. Decode windows split every layer group as
expert_pool_dispatch_multi does: resident experts are VRAM groups, the last
pcie_num/256 of the misses are staged over PCIe, the rest run on the CPU pool
(which now computes only its entries and zeroes the GPU's). The adaptive tier
swaps the most-routed misses in every adapt_every rounds and publishes them
once their copies land. With a profile the prompt path borrows the cache's
last slots and every lent slot is refilled before the decode phase.
Environment switches LELEKA_ORIGINAL_SERVE_EXPERT_* select it for the backend
and the smoke, which now prints per-request prompt/decode timing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 10:48:17 +02:00
Pavlo RatushnyiandClaude Opus 5.5 2bd11e4b23 feat(serve): --prompt-cache flags, reused-token usage for the Original serve path
OriginalServeOptions gains prompt_cache (0 = off, the default until the real-model
smoke passes; the Original uses 6), prompt_cache_every, prompt_cache_root and
turn_token, mapped to StackConfig::conversation; leleka-inference parses
--prompt-cache/--prompt-cache-every/--prompt-cache-root/--turn-token. Usage
reports reused_input_tokens from the stack (generate.cpp REUSED) and the outcome
line prints it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 10:47:52 +02:00
Pavlo RatushnyiandClaude Opus 5.5 70f057578f feat(serve): --kv / --kv-resident on the Original serve stack, KV footprint, long-context smoke
StackConfig gains kv_format (int8 only; fp16, q4_0, k8v4 and keyless are
refused: no sealed owners) and kv_resident (default 32768 = the window every
earlier build used; raised to 20480; 0 = the whole context). open() fixes the
process window (qsa_set_kv_resident) before any QSA owner and prints the
streamed KV footprint (leleka-context KvStreamFootprint: VRAM, prompt stage,
pinned host). leleka-inference takes --kv and --kv-resident.
original_serve_long_context_streamed_kv_smoke (ignored, env-gated): one greedy
request over a 40K-token passcode prompt with a 20480-cell window.
serving_context cross-checks resident pages against the Original kv_plan.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 10:47:16 +02:00
Pavlo RatushnyiandClaude Opus 5.5 6e2c3a10d2 feat(serve): bind the conversation cache to the Original serve stack
generate.cpp --serve's conversation cache (ConversationManager: resume from the live
session or the deepest checkpoint that prefixes the prompt, turn/root/periodic
checkpoints, root-pinned LRU chain) now drives OriginalServeStack behind
StackConfig::conversation (off by default until the real-model smoke passes).

Device side (original_serve_conversation.rs, a child of the stack): a checkpoint is the
session's Original checkpoint (immutable GDN/PLE priors + the twelve resident QSA
witnesses) plus the draft ring snapshot, taken at a published chunk boundary; restore
re-stamps it onto the current branch generation (OriginalSessionCheckpoint::
rebased_onto_current, ResidentQsaPrior::restamped), rolls the session and resident
layers back, re-anchors the ring (OriginalDraftSession::resume_at) and runs the
drafter's kv_restore(resume). Live continuation only when the ring stands at the
session's position (then settle_state runs); parking is refused (opt-in in the Original).
run_request gains resume/finish hooks; prefill reads prompt[resume..n-1] by the plan
with the cache's turn/root options. Host tests: fake-device policy binding and the
request flow.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 10:43:20 +02:00
Pavlo RatushnyiandClaude Opus 5.5 a49e5a935e test(smoke): per-request timing in the parity corpus (TTFT, total, decode tok/s) and LELEKA_SMOKE_REPEAT
Each corpus prompt can be served N times; every pass prints prompt/produced tokens, verify rounds, time to the first emitted
round, total wall time and decode tokens/s, so the first real-model run after a fix yields indicative numbers next to the
Original's own `prefill`/`decode` lines. Indicative only: no paired A/B, single process, cache state recorded by the caller.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 10:42:51 +02:00
Pavlo RatushnyiandClaude Opus 5.5 565061df9d test(kv): model-free GPU proofs of the INT8 KV encoding and of KV streaming
kv_stream_gpu (ignored, needs a device): the prompt-path and verify-window INT8
appends against the Original host reference (experimental-ref kv_q8) byte for
byte over host copy, stage and resident slots; 64 resolve calls over 40960
cells with a 20480-cell window (forced evictions) with the sealed decode
attention bit-equal over the streamed pool, a fully resident identity pool and
the prompt path's staged copy. Resolver::counters ports kv_stream_counters;
the mapped journal exposes resident_pages and stream_counters.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 10:42:51 +02:00
Pavlo RatushnyiandClaude Opus 5.5 90a73bf2cf feat(driver): the verify window's GPU expert plan, PCIe DMA and adaptive slot swaps
The pool callback can now publish the literal GpuPlanSink block of its group
(VRAM groups over completed expert-cache slots, PCIe groups staged by DMA on
the verifier's copy stream with a cuLaunchHostFunc flag-B raise, as
Verifier::fetch_dma), checked against the doorbell's mapped ids. The expert
cache gains the residency test of host_res, the adaptive tier's slot swaps on
their own non-blocking stream with event polling (apply_pending), and a
probe-only slot fill. OriginalExpertTierProbe runs one window group's post
phase eagerly for model-free device proofs (feature expert-tier-probe).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 10:39:30 +02:00
Pavlo RatushnyiandClaude Opus 5.5 93fbf3a8f6 merge: sm_86 companions (RTX 3080) into the bring-up branch
Brings claude/sm86-assets: per-architecture PTX companions under crates/cuda-driver/ptx-sm86 behind the sm86 feature (sm_120 stays
the byte-identical default), 127 companions incl. the newly sealed MMQ-group, mapped-expert-copy and scalar-MTP assets, the
double-NUL lookup fix, and scripts/gpu-bringup/regress_3080.sh (31 items pass on the 3080 in 344 s). Conflict in
desktop-core/Cargo.toml resolved by keeping both the Linux/dev dependencies and the sm86 feature.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 10:38:09 +02:00
Pavlo RatushnyiandClaude Sonnet 5.5 058f2727d6 docs/sm86-assets: merge result, regress_3080.sh, probe limits on the 16 GiB card
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-16 10:37:38 +02:00
Pavlo RatushnyiandClaude Opus 5.5 0103ee90aa feat(kv): per-owner resident KV window for the streamed QSA layers (kv_stream n_slots)
The resolver PTX baked 8192 resident pages (--kv-resident 32768). Port the
Original's KvStreamMap::n_slots: leleka_qsa_resolve and leleka_qsa_stream_reset
take n_slots (resealed with nvcc 13.2.86, sm_120, precise flags; digests in the
window asset, the window seal plan and the ptx_abi test). Every streamed owner
sizes its resident runs and resolver state from the process-wide window
(configure_kv_resident, default 32768 cells = the previous behaviour) and
launches with its own slot count; the verify window carries it in its KV
binding. leleka-context: resident_pages_for (layer.cpp kv_plan rule),
resident_runs, stream_map_bytes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 10:34:33 +02:00
Pavlo RatushnyiandClaude Opus 5.5 d4dac4a335 fix(serve): initialise the streamed-KV resolver before the window capture (one-token prompt)
A one-token prompt runs no prompt append, so the mapped journal's resolver was never
initialised and window_kv_addresses refused at assemble. OriginalQsaMappedJournal::
ensure_resolver initialises it without touching the epoch, coverage or end (unlike
reset), idempotently; assemble calls it for the twelve owners before they move into the
QSA journal and hands the owners back on failure. Model-free GPU test (ignored, no
model) in qsa_mapped_journal.rs; the preflight probe now uses ensure_resolver.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 10:34:09 +02:00
Pavlo RatushnyiandClaude Sonnet 5.5 ab46f18ae6 arch_ptx: with LELEKA_SM86_TRACE also report images that have no companion
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-16 10:22:14 +02:00
Pavlo RatushnyiandClaude Sonnet 5.5 9862b23647 arch_ptx: strip every terminal NUL before the companion lookup
qsa_native_batch.ptx is stored with its own NUL and concat!(include_str!(..), "\0") adds a second, so the image
digest never matched and the sealed sm_120 image reached the driver (INVALID_PTX, code 218) in the executor probe.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-16 10:21:03 +02:00
Pavlo RatushnyiandClaude Sonnet 5.5 b625aa2fc8 regress_3080.sh: read commits from a Windows git worktree under WSL
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-16 10:14:07 +02:00
Pavlo RatushnyiandClaude Opus 5.5 64f117f84b merge: API in front of the Rust engine and the M2 delivery audit into the bring-up branch
Brings claude/api-over-rust-engine (strata-next GrpcBackend worker, scripted engine, Codex request fields, flock flake fix) and
its base claude/m2-control-plane (delivery gap audit, non-panicking control-plane logging, leleka-seal-exec, Dockerfile fix,
run recipe docs) onto the GPU bring-up fixes. No conflicts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 10:10:09 +02:00
Pavlo RatushnyiandClaude Opus 5.5 54fa93e415 chore(bring-up): gate DBG/PROBE diagnostics behind LELEKA_BRINGUP_TRACE
Every bring-up eprintln in leleka-cuda-driver and leleka-runtime (arena/executor/prefill/draft-KV/serve-stack/TracePort tracing)
now goes through crate::bringup_trace!, which prints only when LELEKA_BRINGUP_TRACE is set. Production serving prints nothing
extra. The smoke test and the ignored probes keep their unconditional output. Type-checked with --tests on Linux (WSL).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 10:09:57 +02:00
Pavlo RatushnyiandClaude Sonnet 5.5 6173c2d309 gpu-bringup: regress_3080.sh, one-command model-free regression of a commit on the sm_86 card
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-16 10:04:12 +02:00
Pavlo RatushnyiandClaude Sonnet 5.5 ac638cdad5 sm86: companions for the newly sealed PTX (mmq_original_group_*, mapped_expert_copy, mtp_original_scalar_*)
127 companions now; native_parity.ptx stays an unsealed placeholder.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-16 10:02:47 +02:00
Pavlo RatushnyiandClaude Sonnet 5.5 ba988e741e Merge claude/port-gpu-bringup (9c0605a) into claude/sm86-assets
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-16 10:02:04 +02:00
Pavlo RatushnyiandClaude Sonnet 5.5 9c0605adde fix(serve): run the short-prompt scalar draft K/V prefill on the drafter's own scalar owner (238ba17 from claude/serve-preflight)
Prompts under 64 rows hit the Original's literal RegionTooSmall fallback in the MMQ draft-KV recorder and then ran the scalar prefill on a
standalone owner whose scratch bank is not paired with the ring's main arena (validate_original_main -> InvalidQwenShape ->
InvalidDimension). The drafter now lends its stream to its own scalar owner (OriginalMtpDrafter/Actor::record_scalar_prefill).
Real model, RTX 5090: the 19-token and 56-token prompts of the smoke corpus now serve (16 resp. 10 tokens, the latter ending on <|im_end|>).
Structural evidence only; no numerical claim.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-16 08:46:38 +02:00
Pavlo RatushnyiandClaude Sonnet 5.5 aae33d8b5e test(bring-up): parity corpus and per-row head logprob trace for the Original serve smoke
- backend_original_serve_smoke.rs: LELEKA_SMOKE_PROMPTS (one text prompt per line) is tokenized with the verified tokenizer,
  served greedily for LELEKA_SMOKE_MAX_NEW tokens (LELEKA_SMOKE_MIN_P sets spec_min_p) and printed as ids so the Original
  (strata --tokens-file ...) can be run on the same ids.
- original_serve_native.rs: LELEKA_TRACE_LOGPROBS=<k> prints the top-k head logprobs of every row of each completed verify window
  through OriginalVerifier::window_logprobs_topk (same format as the Original's STRATA_LOGPOS/STRATA_LOGPOS_TOPK).
First measurements against the Original (5 prompts, 64 greedy tokens, same settings): identical on 1 prompt, divergences on the
others after 4..28 tokens; per-row top-8 logprobs differ by a median of about 0.4 (max 2.3). Not parity; investigation continues.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-16 08:32:47 +02:00
Pavlo RatushnyiandClaude Sonnet 5.5 b83aa347ea fix(serve): first real-model Original serve smoke passes on the RTX 5090 (greedy x2 across reset, sampled, cancel)
Findings fixed on the way (all from running the ignored original_serve_smoke against the pinned IQ3_S shards, sealed KAR memfd,
pinned MTP pack and resident expert source; CUDA 13.2.86, sm_120, driver 595.99):
- mtp_original_prefill.rs: the batched draft-KV recorder asked the ring for separately owned DeviceBuffers 0..5, but the serve ring
  is built from prepared spans of the shared region (ring.buffer(i) -> ContextPoisoned). The overlap checks now compare addresses
  via ring.address(i), which handles both layouts.
- session_original_draft.rs: a published speculative draft leaves the MTP ring AHEAD of the committed target (e.g. snapshot 116 vs
  target 114); validate() and rebind_restored() demanded equality and refused the next round. They now require snapshot >= target.
- original_serve_stack.rs/engine: the MTP drafter is sized at the verify width (mtp_load_t = max_t = 6) like generate.cpp, while the
  chain stays capped at 3 drafts (c7b5a08 from claude/serve-preflight).
- smoke: loads the resident expert source, long (114-token) first prompt so the batched draft-KV path (>= 64 rows) is taken, short
  prompt (scalar draft-KV path) last and reported instead of asserted: it still fails with InvalidDimension (open item).
Bring-up instrumentation (to gate or remove before merge): DBG/PROBE eprintln lines, TracePort (logs every OriginalServePort call),
PoisonCell (backtrace of the first context poisoning with LELEKA_TRACE_POISON=1), micro_driver_error tracing.
Structural/behavioural bring-up evidence only: no parity, quality or performance claim yet.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-16 04:29:25 +02:00
Pavlo RatushnyiandClaude Sonnet 5.5 7b04511b9a fix(serve): load the MTP drafter at the verify width, not at its own window width
generate.cpp rewrites o.spec to min(spec+2, 8) (generate.cpp:1535-1537) before mtp.load(..., o.spec, ...) (:2610), so the
drafter accepts every window the verifier runs (suffix drafts reach the verify width) while its chain stays capped by
set_max_drafts(S_mtp - 1). The Rust stack loaded it at settings.mtp_max_t (4): the first T=6 window made
OriginalMtpDrafter::draft_inner refuse (rows > max_t, mtp_original_full_drafter.rs, 2 us, InvalidQwenShape -> InvalidDimension).
OriginalServeSettings::mtp_load_t() (= max_t) now sizes the executor's scalar prefill, the shared layout and the actor.
max_drafts() stays 3.

The synthetic probe now runs the serve round shape (T=1 window+commit+draft, then T=6 with accepted_row 0..5, commit, draft
anchored at the previous speculative snapshot, max_drafts 3, coupled false): PROBE_MTP_MAX_T=4 reproduces the failure, the
default 6 passes for every accepted_row. Structural only; no numerical claim.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-16 03:48:47 +02:00
Pavlo RatushnyiandClaude Sonnet 5.5 494f74ccc9 docs: status, run recipe and contract notes for the API in front of the runtime
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-16 03:17:02 +02:00
Pavlo Ratushnyi 7b833d552a chore: clippy-clean the new code (unused import, map_or identity, ptr_arg) 2026-10-16 03:16:18 +02:00
Pavlo RatushnyiandClaude Sonnet 5.5 6b34f0101d test: wait for a flock to be released after a dropped handle instead of flaking
flock belongs to the open file description. A child that another test forks while the handle
is open keeps the description until it execs, so a lock can outlive drop() by milliseconds in a
parallel run. The journal and history tests now retry the reopen for up to 10 s; production keeps
refusing a held lock at once. 12 of 12 consecutive parallel runs of the desktop-core lib suite
pass (3 of 5 failed before). Also: documented runtime config example, validated by a test.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-16 03:13:38 +02:00
Pavlo RatushnyiandClaude Sonnet 5.5 edb2d49687 feat(control-plane): accept the harmless Codex hints (service_tier, user, text.verbosity, reasoning.effort minimal, summary none)
text.format becomes optional so a text object may carry only a verbosity. concise/detailed
summaries, max_tool_calls and other include values stay refused. New HTTP tests run a Codex-shaped
two-turn exchange with stateless replay and the tool_choice / parallel_tool_calls enforcement
through the runtime stack.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-16 03:06:03 +02:00
Pavlo RatushnyiandClaude Sonnet 5.5 0ca493be04 test: run the scripted-engine HTTP smokes through the runtime stack (fake_runtime over real gRPC)
fake_runtime is a leleka.runtime.v1 server (the real RuntimeServer) whose engine is the same
engine.sh the smokes already use; fixture.runtime_stack() swaps strata-next's engine child for
it when STRATA_TEST_FAKE_RUNTIME is set, otherwise nothing changes. scripts/test-api-over-runtime.py
runs the ten smokes whose assertions do not depend on strata-next owning the engine process.

The HTTP layer clamps reasoning_tokens to the engine-reported output total, which a text-level
engine's re-tokenized pieces can otherwise exceed.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-16 03:00:55 +02:00
Pavlo RatushnyiandClaude Sonnet 5.5 26574ae3e7 test(desktop-core): the API in front of the real RuntimeServer over gRPC with a scripted engine
Six chain tests: streaming and JSON Responses, length/tool-call/stop-marker, client
disconnect cancelling through gRPC, engine failure and a dying engine ending with
response.failed, a restarted runtime flipping readiness and being reattached, and a test
that records the runtime's 256-generations-per-epoch limit.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-16 02:50:34 +02:00
Pavlo Ratushnyi d358a80cd9 test(control-plane): output cap and sampling fixed point reach the engine 2026-10-16 02:47:08 +02:00
Pavlo RatushnyiandClaude Sonnet 5.5 c8601d0b2c feat(control-plane): runtime block selects the runtime backend; strata-next serves in front of leleka-inference
runtime.{address,token_env,tokenizer_dir,model,mode,max_context} are validated at load
(loopback only, credential from the environment and never printed, exclusive with
engine/native_model/mtp_pack/vision/gpu). serve spawns backend_worker over GrpcBackend.
The worker carries the runtime's output-token cap in WorkerStatus; a default budget never
exceeds it, an explicit request above it is refused. Request ids are UUIDs, as the
runtime contract requires.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-16 02:46:22 +02:00
Pavlo RatushnyiandClaude Sonnet 5.5 c9aad38caa refactor: extract the runtime gRPC client into leleka-runtime-client and add GrpcBackend
proto/runtime.proto, the wire conversions and the validated RuntimeClient move out of
strata-desktop-core so strata-next can use them; strata-desktop-core re-exports them
unchanged. GrpcBackend implements the Backend contract by attaching to a runtime an
operator already loaded (no Load/Unload RPC), re-reading epoch and handle before every
generation, and ending a generation without a terminal event on any transport or frame
error. 9 loopback HTTP/2 tests with a scripted runtime server.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-16 02:42:11 +02:00