Pavlo Ratushnyi baf93de2e7 STRA-338 S13: serve and decode settings
Adds the Settings port to leleka-runtime (src/settings.rs): an EnvSource trait with a ProcessEnv adapter
(the only std::env user) and a MapEnv adapter for tests, and a Settings value that captures the operator
namespace (LELEKA_*, STRATA_*) once, parses the plain switches and numbers into typed topic structs, and
hands the captured namespace to the parsers that report errors themselves. settings::process() is the
instance of the process; the load path carries it as LoadEnv::settings.

Serve topic: GGUF-PLE switch, public evaluation, profile name and digest, capture dir, the GiB budgets of
the memory plan, CPU worker count and pool plan, prefill loan tiers. The conversation cache policy, the PLE
reader policy, the memory governor config and the sampler path read the captured namespace.

Decode topic: coupled, overlap, draft-after-commit, serial publish, adapt defer, suffix reset, spec trace
and stats, logprob/draft/residual traces. The speculative engine, arm list, adaptive config and NaN guard
parsers take the captured namespace instead of calling std::env. LELEKA_SPEC keeps both of its readings:
the numeric one (a malformed value is ignored) and the set-ness one that decides whether the adaptive
window is the default (a malformed value still counts as set).

Parse semantics are unchanged per key; settings/*_tests.rs pin each spelling with a MapEnv. The cached
OnceLock readers of these keys are gone (process-global 113 to 93, env-read 93 to 59).
2026-11-05 22:09:14 +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: leleka-runtime (engine), 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.

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%