- deploy/Dockerfile.windows-build cross-compiles the six executables (mingw, no Visual Studio needed)
- control-plane/build.rs: the ggml link stubs are used for every Windows target, not only MSVC
- scripts/windows/Start-Leleka.ps1 (igpu | cpu | npu modes, speculation and cache slots on by default) and Package-Windows.ps1
- docs/windows-runtime.md; stale statements in docs/cpu-runtime.md corrected
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The KAR codec moves unchanged from control-plane/src/kar_codec.rs into crates/kar-codec
(re-exported there, so the control plane's KAR tests are unchanged and pass). Probes, off
unless set: LELEKA_EXPERIMENTAL_KAR_LEVELS / _KAR_TENSORS for attention and output weights,
and LELEKA_EXPERIMENTAL_KAR_EXPERT_LEVELS / _KAR_EXPERT_LAYERS for the MXFP4 experts
(level 0 is a storage-only control). Teacher-forced against llama.cpp, baseline KL 0.016:
attention+output at 6.5/5.5/4.5 bits give KL 0.063/0.095/0.213 (uniform rounding was
0.071/0.112/0.270), and every tensor group fails alone; experts of 6 of 24 layers at 3.5
bits give KL 0.081 (control 0.018). No KAR rate passes the gate on this model. Corrects the
earlier doc claim that a KAR layout is the same as uniform rounding.
iGPU and NPU prefill run at the same time give 93-98 tok/s in total against 73-77 for the
faster device alone (2048 tokens each, two rounds).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
LELEKA_SPECULATION_LOG=1 now also prints, per request and with or without --speculate, where the decode time went:
passes by number of tokens (count and mean), sampling, output lines, drafting, cache cuts and the rest.
Measured with it (ab_speculation, 2 pairs, quiet machine, outputs identical in all 16 runs; paired speed-ups 1.55,
1.12, 1.01, 0.97): everything outside the model passes is under 0.5% of decode time (sampling 40-64 ms per request,
the rest a few ms), and single steps cost the same in both arms (81-93 ms). Verifying passes in the worker cost
1.57, 2.04, 2.50, 2.99, 3.66, 4.04, 4.32, 4.80 single steps for 2-9 tokens, 3% above batch_cost's random-id passes at
2-3 tokens and 8-22% above from 4 tokens on, which accounts for the rewrite's 1.55 against the replay's 1.59.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The ab_speculation run recorded in 87637c2 overlapped another session's GPU prefill probe (not in the busy check),
so it is now marked disturbed and kept only for the record. Rerun on a quiet machine with the other session holding
all heavy work (processes checked before, between and after; machine state before and after in the results file):
- batch_cost ab, 9 rounds: identical logits in all 90 paired passes; time ratio with/without 1.02, 1.05, 0.94, 0.87,
0.83, 0.81, 0.80, 0.76, 0.76 for 1-9 tokens, confirming the first paired run.
- ab_speculation, 3 pairs, outputs identical in all 24 runs: rewrite 1.54 (1.49, 1.61, 1.52; 1.25 before the change),
diff 1.06, json 0.97, explain 0.97. The drafter replay predicted 1.59 / 1.15 / 1.00 / 0.99, so there is no hidden
serving-loop cost; the rewrite drafts longer runs (39-41 verified batches instead of 43-56).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Profiling the speculative verification pass (batch_cost, position 900) showed its extra cost is compute in the
int8 weight products, not expert bytes: distinct experts per layer rise only from 4 to 9.5 at 9 tokens, while the
Q8_0 projections, whose weights every token shares, cost 3.6-4x a single step. Each (row, token) dot redid the
MXFP4 decode and scale work.
cpu-sys gains multi-activation kernels (portable, AVX2, AVX-VNNI) for MXFP4 and Q8_0 rows: the row is decoded once
per 64-block segment and up to 16 activations run over it with exactly the one-token kernel's accumulators and
final reduction, so every output is bit for bit the one-token kernel's (tests/multi.rs: every level, 1-16
activations, 13 row lengths). run_region uses them for jobs with two or more activations (speculative batches and
prefill chunks); one-token decode keeps its kernel. A new synthetic test checks a 20-token batch at every level
against feeding tokens one at a time. Model::set_multi_activation(false) restores the per-token path for paired
measurements; Profile counts the expert sets read.
batch_cost gains a per-size phase breakdown and an `ab` mode that runs every pass without and with the new kernels
back to back and checks the logits are identical. Paired, 9 rounds, real model: identical logits in all 90 paired
passes; time ratio with/without 1.01 (1 token), 0.98, 0.92, 0.90, 0.83, 0.81, 0.77, 0.79, 0.76 (2..9 tokens).
MEASURED_COST becomes 0.737 + 0.421 n (was 0.30 + 0.631 n). ab_speculation (3 pairs, outputs identical in all 24
runs) gave 1.34 / 1.04 / 0.97 / 0.94, within the pair-to-pair spread of the run before the change; replaying the
outputs through the drafter predicts 1.59 / 1.15 / 1.00 / 0.99, so the serving loop loses time the pass-cost model
does not see. Prefill also uses the kernels (bit-identical); its speed was not measured.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ab_speculation: four agent-style prompts, 3 alternating pairs, greedy, identical
outputs in all 96 runs; copy-heavy output 1.10-1.36x decode, new text within noise
of 1.0. batch_cost: a CPU pass over n >= 4 tokens costs about 0.65 n single steps, so
CPU speculation is capped near 1.5x. One 9-token pass takes 7.3 s on the iGPU and
6.3 s through the NPU service against 0.75-0.93 s on the CPU, so neither is used for
verification.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Keys and values are stored as IEEE half floats (49 KB per token instead of 98 KB, llama.cpp's default
cache type). New cpu-sys kernels read them directly: attention scores and weighted value sums over half
floats (portable and AVX2 + FMA + F16C, blocked over positions like the f32 ones) and a vector
float-to-half conversion that is bit-identical to the portable one. The decoder writes rotated keys and
values through Dispatch::f32_to_f16; the synthetic f64 reference rounds K and V the same way.
Teacher-forced gate against llama.cpp (same 383 tokens): best token 97.4% (unchanged), mean KL 0.0077
(was 0.0082 with f32 cache), next-token NLL 1.2852 vs 1.2798. The conversions cost a little attention time
(2,000-token context, one noisy run: decode attention 9.9 ms against 7.7 ms with f32), which is the price
of halving the cache. The worker's default context rises to 32,768 tokens (1.6 GB).
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
benchmarks/tools/Smoke-GptOssStack.ps1 starts strata-next with leleka-cpu-worker for a GGUF and checks a
plain question, a function call, a tool-result round trip that must reuse the cached prefix, and a
streaming request, then stops what it started. Run on the reference laptop with gpt-oss-20b: all pass
(second-turn prefix reuse 134 of 181 prompt tokens; 5.3 s for a short answer, 6-8 s for tool turns).
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Attention was scalar and latency bound. New kernels in cpu-sys (portable and AVX2 + FMA): scores for a
group of query heads against strided keys, weighted value sums for the group, and a vector exp for the
softmax (relative error below 3e-7). The 8 query heads that share a KV head are processed together over
blocks of 16 positions, so each key and value row is read into L1 once per group instead of once per head.
ops::attend_group_with_sink uses them through Dispatch; a group is bit-identical to its heads run one at a
time (test), and the kernels are checked against f64 references for odd widths, strides and block sizes.
Measured on gpt-oss-20b, 10 threads, 2,000 tokens of context (one run each, noisy machine): decode
attention 27.4 -> 14.5 -> 7.7 ms per token (per-head SIMD, then grouped), decode 116 -> 95 ms per token
(10.5 tokens/s, the same as at short context); prefill attention 8.9 -> 2.1 ms per token. Teacher-forced
quality gate against llama.cpp: best token 97.4% (was 97.1%), mean KL 0.0082 (was 0.0080).
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
New crate leleka-cpu-worker (executable leleka-cpu-worker --serve --model <gguf>): loads the GGUF through
the read-only mapping, runs the gpt-oss decoder on the AVX2 / AVX-VNNI kernels, and speaks the stdin/stdout
protocol of Strata's --serve mode (READY, GEN with temperature, top_p and seed, STOP, QUIT, PP, REUSED, T,
DONE, ERR). Prefix reuse across requests, cancellation between prefill chunks and between tokens, a stale
STOP while idle is ignored, the end-of-generation marker is emitted as the last token.
leleka-gptoss gains sampling (greedy, or temperature and top-p over the 1,024 best logits, with a seeded
generator) and prefill_reuse_with (progress and cancellation). A stray NUL byte left in a doc comment by an
earlier shell edit is removed.
Tests: protocol parsing, the request loop against a mock decoder (stop token, length, reuse, STOP, QUIT,
engine failure, broken pipe), and an end-to-end run on the real model (needs LELEKA_GPTOSS_GGUF) that gets
llama.cpp's 16 greedy tokens for "The capital of France is" and reuses the prefix of a longer prompt.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>