Brings the Rust/CUDA port of the Strata mode17 serve path together with the
CPU/iGPU/NPU gpt-oss runtime that main gained meanwhile.
Control plane: the Qwen tokenizer is the implementation behind the Qwen35
variant of codec::TextCodec (qwen(), encode_prompt() widen the trait; QwenCodec
derefs to the tokenizer), so control-token marks, images, chat template, the
runtime backend and vision keep their behavior, while the gpt-oss/Harmony path
and the worker pool keep main's. Config carries the union of fields; extra_workers
is rejected together with runtime, lazy_load, idle_unload_s and vision; the
gpt-oss family refuses top_k/min_p/penalties (its GEN line has no such keys).
leleka-kar-codec takes f16_bits_to_f32 from leleka-quant-core (identical code).
Workspace members and default-members are the union of both sides.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
leleka_tokenizer::LiteralMarks swaps every special literal (GGUF token type 3 and 4) in a client string for a plane-15 private-use mark
before the chat template runs (a forged mark is escaped); Tokenizer::encode_marked parses the template's own literals as special tokens and
encodes each mark's literal as ordinary text. render_request marks instructions, message text, reasoning, call arguments, tool outputs and
tool descriptions/schemas; the gateway's own tool markers stay literal. Generation and /input_tokens share the one encoding; the text
contract carries the marked string and leleka-runtime reads it with encode_marked.
Not covered: strata-desktop-core still renders unmarked text; live Codex session (gate L) not run.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* 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>
Setting engine.gptoss_gguf (or STRATA_GPTOSS_GGUF) selects the gpt-oss family and takes the tokenizer from
that GGUF. Prompts: a Responses request (instructions, input items with reasoning, function calls and
outputs, tools, tool_choice, parallel_tool_calls, text.format, reasoning effort) is rendered as the Harmony
conversation by leleka-harmony; the same replay validation as the Qwen path, one call per assistant message
with its output, no custom tools. Output: a stateful HarmonyDecoder turns the generated tokens into the
reasoning / answer / <tool_call> markup that the existing code parses, so tool-name and argument
validation, history and the streaming events are reused; gpt-oss always reasons, the end-of-generation
markers <|return|> and <|call|> are the terminal tokens, and an open tool call is closed when the
generation ends.
Safety: the renderer can write its special markers as private-use sentinel characters (and replaces those
characters in caller text); the codec turns exactly those into special tokens. Marker-looking text from a
client, in messages, tool descriptions or tool output, stays ordinary text.
Side effect, deliberate: serde_json preserve_order is now on workspace-wide (the renderer needs the client's
property order), so tool-call argument objects keep the model's key order instead of alphabetical; one test
expectation changed accordingly. 52 responses tests and the new family tests pass; the 13 other
control-plane test failures on Windows predate this change.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
leleka-tokenizer gains gguf_bpe: a byte-level BPE tokenizer built from the vocabulary in the GGUF file
(gpt2 model, gpt-4o pre-tokenizer), with special-token parsing that is off by default so user text cannot
forge markers, and a UTF-8-safe streaming decoder. Checked against llama.cpp's /tokenize on 67 strings: same
ids except the two documented differences (llama.cpp forges some Harmony markers from text; it splits
words at combining marks, which the o200k expression keeps together).
New leleka-harmony crate: render() reproduces the gpt-oss chat template (including its whitespace) and is
byte-identical to llama.cpp's /apply-template on ten conversations with many tool-schema shapes;
HarmonyParser turns generated tokens into reasoning, answer and tool-call events.
The oracle fixtures are test strings, token ids and rendered prompts only. The tokenizer oracle test needs
LELEKA_GPTOSS_GGUF and reports "skipped" without it.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
- crates/tokenizer pre_tokenize + model pre-tokenize-batch/tokenize-batch/detokenize-batch (debug/differential)
- scripts/offline/diff_tokenizer.py: every Unicode scalar x 13 contexts vs Python regex (0 real mismatches;
14k strings differ only where regex 2026.9.10 has Unicode 17 and regex-syntax/unicodedata 16), a synthetic
GGUF with BPE-trained merges past the heap path, 5-file extraction compare, encode/decode fuzz
- golden crates/tokenizer/tests/fixtures/tokenizer_oracle.json + integration test
- stricter-by-design: duplicate merges, missing chat template, negative special ids
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>