Pavlo Ratushnyi ddea3ac916 STRA-338 S23: close the golden gaps of the second review, recorded on the code before S23
29 more cases (159 cases, 318 captures), recorded on 08afbf216 in a temporary worktree and checked against the new code; none
differs. New cases: the request's max_output_tokens reached (text, reasoning, closed reasoning, tools, structured, gpt-oss);
Qwen reasoning on with json_schema valid and violated; gpt-oss json_schema, tools with structured output, effort none with
tools; Qwen reasoning plus tools at the length limit with calls inside the unclosed reasoning, and without; namespaced tools
through the stream and the buffered reading (Qwen with and without reasoning, gpt-oss); DONE before the first token and an error
after DONE (all four readings); a worker that reports fewer generated tokens than the reasoning took (the reasoning_tokens
clamp, usage output_tokens).
New tests of the binary (15 pass on 08afbf216 and on the new code): the stored response equals the one the client was sent
(streamed and not, six cases); a client that leaves at DONE closes the source (five cases, among them the final preview
flush); what reaches the worker: gpt-oss gets none of the server defaults for the samplers it lacks (top_k 20 and
penalty_last_n 64 included), accepts neutral values, Qwen keeps all five samplers and penalty_last_n, own and default.
In the lib: BufferedRun finishing its generation twice returns the shared GENERATION_ENDED error and fail() sends
response.failed; a token after the end fails the stream.
regenerate_output_golden now refuses unless OUTPUT_GOLDEN_RECORD names the pre-S23 commit and the tree has no output module
(checked: it panics on this tree); output_events.recorded_on names 08afbf216 and a test pins it.
2026-11-06 23:37:15 +01:00

Leleka

Leleka is a Rust/CUDA inference runtime for coding agents. Release 0.1 serves one model, Qwen3.8-Flash-Next IQ3_S (KAR level-2 PLE, MTP speculative decode), on one RTX 5090 (32 GB) at 262,144 tokens of context, to Codex CLI and other clients over the Responses, Chat Completions and Messages APIs. It is a Rust/CUDA port of the Original mode17 serve path of Strata (reference copy in engine/strata/, pinned at upstream 41cf05a0, see docs/upstream.md). Serving needs no Python and no CUDA toolkit on the host.

Status of 0.1. It runs real Codex sessions to completion and decodes about 155 tok/s on the 245k-token benchmark of the 5090 server (section "Numbers"). It is not a formally quality-gated profile, only the RTX 5090 is supported, and the limits below are real. Release notes: docs/release/RELEASE-NOTES-5090-v0.1.md; every gate and its evidence: docs/release/5090-v0.1-checklist.md.

Requirements

GPU RTX 5090 (sm_120, 32 GB), driver >= 595 (measured with 595.99.02). Any other GPU: not supported in 0.1 (an RTX 3080 laptop profile exists, experimental, not run for this release)
host Linux x86_64, glibc >= 2.39 (measured: Ubuntu 26.04), >= 100 GiB RAM, a fast local NVMe, about 140 GB for the model volume
libraries libcuda.so.1 (driver) and libcublas.so.12 (CUDA 12; leleka up fetches the pinned 12.9.1.4 redistributable if missing)
model Qwen3.8-Flash-Next IQ3_S + KAR archive + MTP pack, digests pinned in the binary (leleka verify). Obtaining and using the model under its own licence is the user's responsibility.

Install and run

From the unpacked release (leleka-0.1.0-COMMIT12-5090-linux-x86_64.tar.xz; check SHA256SUMS, ./bin/leleka version shows the commit and the Strata pin):

./bin/leleka up --dry-run --assets /data/leleka     # preflight + plan + the exact engine command; changes nothing
sudo ./install.sh --assets /data/leleka             # prepare, install, start the systemd service, wait for /ready (or --foreground)
./bin/leleka status                                 # ready?, uptime, restarts, GPU/RAM/throughput, expert tier ON/OFF
curl -H "Authorization: Bearer $(cat STATE/api-key)" http://127.0.0.1:8081/v1/models

The API listens on loopback only (use an SSH tunnel); the key is in STATE/api-key. Codex CLI: wire_api = "responses", base_url = "http://127.0.0.1:8081/v1", web_search = "disabled". Details, every flag, upgrade and rollback: docs/deploy.md, docs/unattended.md (running it as a boot-time service: scripts/ops/, installed by the owner of the machine, never by the release). Upgrade: stop the service, keep a copy of STATE/*.json, unpack the new release, run its install.sh with the same flags. Rollback: restore the copies and run the previous release's install.sh.

Numbers (measured, paired, one workload)

Decode tok/s on the frozen 245k-token corpus (5 turns x 300 output tokens, greedy, RTX 5090, Ryzen 9 9950X3D), ours against vanilla Strata 0.2.6 on fresh boots, vanilla in its good huge-page state (docs/experiments/baseline-pair-5090.md, section 10, 3 balanced blocks): ours 155.4 (sd 2.4), vanilla v1 (its shipped lossy defaults) 137.0 (ahead of it in 3 of 3 blocks, +13.5 %), vanilla v2 (lossless-comparable) 144.7 (ahead in 2 of 3 blocks, +9.2 %; vanilla v2 is bimodal and ran 171.2 once, 10.8 % faster than ours). Later changes: the faster draft attention is bitwise identical and shortens a round by 2.7 % (tok/s +0.5 % +- 0.6 %, not significant); the window policy default +1.1 % +- 1.2 % (not resolved, no speedup claimed); the single-copy memory layout (docs/kar-sparse-memfd.md) is identical in output (2057/2057 logprob rows, 1036/1036 draft traces) and frees 36.6 GiB of RAM at 245k (MemAvailable 8.5 to 45.1 GiB; tok/s +0.58 %, n.s.). These are decode speeds of a benchmark, not agent-task times.

Quality and limits

  • Not bit-identical to the Original; deviations are inside the Original's own rounding envelope where tested (docs/quality-gate.md), and there is no 245k port-versus-Original equality gate yet (STRA-337). KAR level-2 PLE, chain kernels, prefill chunk 8192, request-end prefix checkpoints and the adaptive expert tier have no 256k gate. All evidence is greedy.
  • Lossy modes are off: route tail skip gave +15 % decode but failed its quality gate; keyless KV failed too. Tool calls are the model's: malformed ones are refused, not repaired.
  • One generation at a time (queue of 16); images and reasoning_budget_tokens are refused; RTX 3080 and Windows are not part of 0.1; no multi-hour soak on the release commit (post-release feedback).
  • Cold start is dominated by reading the 55 GB archive from disk; with the O_DIRECT loader and the sparse copy the measured times are in the release notes.

Observability

What the service is doing, and why a request was slow or failed, is in its logs; nothing needs a debugger, and nothing leaves the machine.

  • Logs. STATE/logs/{leleka,engine,gateway,api,requests}.log, one JSON object per line: UTC timestamp (ms), level, component, event, flat fields. The supervisor rotates them by size (leleka.json logs); a repeating event is sampled (a burst, then one line per 10 s with a suppressed count), so a failure loop cannot fill the disk. Prompts and answers are never written; the API key and tokens are scrubbed from every line. LELEKA_LOG_LEVEL, LELEKA_LOG_FORMAT=json|text|legacy and LELEKA_LOG_DEBUG=1 (adds the length of redacted text) are read by every process. A binary started by hand keeps the plain lines that scripts/e2e parses.
  • One record per request (requests.log, about 0.5 KB): request id (also the x-leleka-request-id response header), session tag, dialect, model, profile, prompt / cached / output tokens, queue wait, time to first token, prefill and decode tok/s, finish reason, error class, whether the engine was lost meanwhile, GPU clock, temperature and throttle reasons. The engine writes its own line for the same id (tokens per speculative round, expert-tier share served from VRAM / PCIe / CPU).
  • Commands. leleka logs --tail 100 --since 1h --level warn, leleka logs --request ID (API and engine lines of one request, joined), leleka status / leleka verify --quick (request statistics of the last quarter hour, failures), and leleka report: a sanitized support bundle (versions, commit, Strata pin, profile, expert tier ON/OFF with digest, hardware, service health, request statistics, the last 50 request records, recent warnings) in one JSON file. report shows what it would contain and writes only with --yes; you attach the file yourself. See leleka --help.
  • Metrics. GET /metrics?format=prometheus: request counters by endpoint and outcome, histograms (time to first token, duration, queue wait, tokens, tok/s), engine restarts and uptime, queue depth, VRAM and host memory, GPU clocks / temperature / power / throttle reasons, PCIe MB/s, speculative tokens per round, expert-tier entries by tier. Every label value comes from a fixed list.

Repository layout

  • crates/ — the runtime: engine-qwen35-cuda (the engine; leleka-runtime is its facade), engine-core (pure engine domain), cuda-driver (CUDA Driver API, sealed PTX), leleka-memory (memory governor), obs (logging), deploy (the leleka binary), model-format, tokenizer, sampler and CPU kernels.
  • control-plane/, desktop-core/ — the HTTP/Responses gateway (strata-next) and the engine/daemon processes.
  • engine/strata/ — the pinned upstream Strata, the reference (unmodified by Leleka).
  • deploy/, scripts/ — profiles, service templates, release packager (scripts/release/), test and measurement tooling (Python is allowed there, never in serving).
  • PROJECT_CHARTER.md, docs/ — requirements, provenance, decisions, gates and measurements. Architecture: docs/architecture/hexagonal.md.

Model weights, request captures, credentials, logs and generated artifacts stay outside Git.

Development

cargo test --workspace --locked
cargo clippy --workspace --all-targets --all-features -- -D warnings
scripts/release/package-5090.sh check        # the release gates; `package` builds the release set (docs/release/5090-v0.1-checklist.md)

Licence

MIT (LICENSE). A commercial licence is available on request. Third-party notices: docs/release/licence-and-secrets-audit-5090-v0.1.md; the Strata reference is MIT (engine/strata/LICENSE).

S
Description
No description provided
Readme MIT
77 MiB
Languages
Rust 69.4%
Python 12.1%
Cuda 10.1%
Shell 4%
C++ 2.3%
Other 1.8%