Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
4a32349
models : fix GDN normalization from max to rsqrt
danielhanchen Sep 29, 2026
f81656e
improve: conventor hook backport
notforu777 Sep 30, 2026
04bbebd
feat: added laya and decision tools libs. also tests
notforu777 Sep 30, 2026
61d6232
feat: llama-server --decision, документация, CI
notforu777 Sep 30, 2026
d1ef30c
fix(tests): no 128-bit int MSVC
notforu777 Sep 30, 2026
15cbf42
improve(tests): cp1251 supp
notforu777 Sep 30, 2026
e607036
improve(laya): CPU speed, english Laya, Windows-fixes C++, tools for …
notforu777 Sep 30, 2026
8db5bd0
laya-convert: C++ HF checkpoint to GGUF converter, CLI and tests
notforu777 Oct 1, 2026
d808e95
decision: -m <checkpoint dir> with a GGUF cache
notforu777 Oct 1, 2026
1b4d9ac
ci: build and test the converter
notforu777 Oct 1, 2026
6da0ad7
docs: converter and checkpoint directories
notforu777 Oct 1, 2026
d7bab68
fix(decision): drain the log before exit; byte-exact spec on Windows
notforu777 Oct 1, 2026
fc7b161
Merge pull request #85 from AtomicBot-ai/feature/decision-convert-p4
notforu777 Oct 1, 2026
67dbbb4
test(laya): parity tooling, tiers v2 and the Phase 4b gate summary
notforu777 Oct 1, 2026
7da782f
feat(laya): GPU backend (Metal/CUDA/Vulkan), precision, placement and…
notforu777 Oct 1, 2026
4a65e50
feat(decision): --decision-device/--decision-precision in the engine,…
notforu777 Oct 1, 2026
9337e97
test(decision): backend parity/precision tests, server tests, Windows…
notforu777 Oct 1, 2026
2bb544c
scripts: device bench and report
notforu777 Oct 1, 2026
06d8fba
docs: GPU backend in DECISION.md and CHANGELOG
notforu777 Oct 1, 2026
f96a152
test(laya): separator-safe build-root check in parity identity (Windows)
notforu777 Oct 1, 2026
27cc6b3
Merge pull request #86 from AtomicBot-ai/feature/decision-gpu
notforu777 Oct 1, 2026
bcc1145
release: b10269-1.7.0
notforu777 Oct 1, 2026
235627c
Merge branch 'master' into release/b10269-1.7.0
notforu777 Oct 1, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 98 additions & 0 deletions .github/workflows/dev-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ on:
- '**/*.comp'
- '**/*.glsl'
- '**/*.metal'
- 'tests/laya/parity/**'
# No paths filter: these jobs are required status checks on dev, and a
# required check that never reports leaves the PR stuck in "Expected"
# forever (e.g. a docs-only PR). Runs on PRs into master too so the
Expand Down Expand Up @@ -1024,6 +1025,103 @@ jobs:
llama-turboquant-macos-arm64.tar.gz
retention-days: 14

# Decision mode (DECISION.md): C++ unit tests and the offline server contract
# tests. Warnings are errors on the Linux leg only. Builds only what the
# tests need and no archive, so publish-dev-latest does not wait for it.
decision-tests:
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, windows-2025]
runs-on: ${{ matrix.os }}

steps:
- name: Clone
uses: actions/checkout@v6

- name: ccache
uses: ggml-org/ccache-action@v1.2.21
with:
key: turboquant-decision-tests-${{ matrix.os }}
evict-old-files: 1d

# before the builds: CMake registers the tiny-GGUF fixture of test-laya-backend-parity only when
# its interpreter has numpy and pyyaml
- name: Python setup
uses: actions/setup-python@v6
with:
python-version: '3.11'
pip-install: -r tools/server/tests/requirements.txt

- name: Build (Linux)
if: ${{ runner.os == 'Linux' }}
run: |
cmake -B build \
-DCMAKE_BUILD_TYPE=Release \
-DGGML_NATIVE=OFF \
-DLLAMA_CURL=OFF \
-DLLAMA_OPENSSL=OFF \
-DLLAMA_BUILD_SERVER=ON \
-DLLAMA_BUILD_TOOLS=ON \
-DLLAMA_BUILD_TESTS=ON \
-DLLAMA_BUILD_EXAMPLES=OFF \
-DLLAMA_FATAL_WARNINGS=ON \
-DPython3_EXECUTABLE="$(command -v python)"
cmake --build build --config Release -j $(nproc) \
--target test-decision-json test-decision-request test-decision-calib test-decision-router test-decision-reference test-laya-convert llama-server llama-laya-cli llama-laya-convert test-laya-backend-precision test-laya-backend-parity

# same toolchain as the server.yml Windows job
- name: Build (Windows)
if: ${{ runner.os == 'Windows' }}
shell: cmd
run: |
cmake -B build -G "Ninja Multi-Config" ^
-DCMAKE_TOOLCHAIN_FILE=cmake/x64-windows-llvm.cmake ^
-DGGML_NATIVE=OFF ^
-DLLAMA_CURL=OFF ^
-DLLAMA_OPENSSL=OFF ^
-DLLAMA_BUILD_SERVER=ON ^
-DLLAMA_BUILD_TOOLS=ON ^
-DLLAMA_BUILD_TESTS=ON ^
-DLLAMA_BUILD_EXAMPLES=OFF ^
-DPython3_EXECUTABLE=%pythonLocation%\python.exe
cmake --build build --config Release -j %NUMBER_OF_PROCESSORS% ^
--target test-decision-json test-decision-request test-decision-calib test-decision-router test-decision-reference test-laya-convert llama-server llama-laya-cli llama-laya-convert test-laya-backend-precision test-laya-backend-parity

# decision + the checkpoint converter (test-laya-convert, test-decision-checkpoint-cli); the Python
# cross-check (label python) needs torch + transformers 5.17 and runs locally (make_tiny_hf_laya.py --check)
- name: Unit tests
run: ctest --test-dir build -C Release -R "decision|laya-convert" -LE python --output-on-failure

# laya backend tests: exit code 77 (no GPU / iGPU device on the runner) counts as skipped
- name: Laya backend tests
run: ctest --test-dir build -C Release -L laya --output-on-failure

# the Python reference of the router rendering and the calibration tools; the golden file
# that test-decision-reference reads must match a fresh run of its generator
- name: Reference tests
shell: bash
env:
PYTHONIOENCODING: 'utf-8'
run: |
python -m pip install jsonschema
python tests/decision/gen_router_golden.py --check
python -m pytest -v tests/decision/test_reference.py

# offline: the tests generate a tiny random laya GGUF
- name: Server tests
shell: bash
env:
PYTHONIOENCODING: ':replace'
run: |
cd tools/server/tests
python -m pytest -v unit/test_decision.py

# offline: backend parity gate, identity records, corpus regenerates to the recorded sha256
- name: Parity tooling tests
shell: bash
run: python -m pytest -v tests/laya/parity

# Republishes the rolling `dev-latest` prerelease with whatever archives the
# build jobs produced. Runs even when some jobs fail (if: always()) so a
# broken backend never blocks the others from shipping to testers — the
Expand Down
185 changes: 185 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,191 @@ commit list underneath.

Releases before `b10269-1.5.0` predate this file; see the git history.

## b10269-1.7.0

### Added

- **Decision models in `llama-server`** (`--decision`, see `DECISION.md`). A
separate server mode for Jev-class decision models: no chat routes, one
worker (on the CPU unless `--decision-device` says otherwise), calibrated
probabilities instead of generated text.
- `POST /v1/systemone`: TypeSafe-compatible typed questions (noul, choice,
score) over a state.
- `POST /v1/router/score`: executor cards in, an independent calibrated
`p_success` per candidate out (Platt calibration from the model's spec; 501
unless calibrated or `--decision-allow-uncalibrated`).
- `/health`, `/props` (`decision` block with limits, plan and calibration),
`/v1/models` capabilities, an error envelope with stable reason codes, and a
bounded queue (429 + `Retry-After`).
- New flags: `--decision`, `--decision-spec`, `--decision-plan`,
`--decision-queue`, `--decision-max-items`, `--decision-allow-uncalibrated`,
`--decision-debug`, `--decision-kernels`, `--decision-precision`,
`--decision-device`, `--decision-gpu`, `--decision-strict-placement`.
- `systemone` answers carry `action.act_probability` (the reference agent's
action head, `round(softmax(act logits)[0], 4)`); with `--decision-debug`
the raw act logits are in `debug.act_logits`. Router answers do not have it.
- An internal error answers 500 with a fixed message; the exception text goes
to the server log only.
- `--decision-precision default|strict`: the matmul precision request of the
laya graph. The CPU computes the same bits in both modes; on CUDA `strict`
is the parity-audit mode (PEDANTIC on every matmul, slower), not a serving
mode.
- Experimental: `--decision-device gpu|auto` (and `--decision-gpu`,
`--decision-strict-placement`) runs the laya graph on a GPU through the
stock ggml backends; the default stays `cpu`. `/props.decision` reports the
device and where the graph nodes run. Metal passes its parity tier
(`f16-class`) against the CPU on the full parity corpus; CUDA (RTX 4090)
passes its tiers, `--decision-precision strict` included, and Vulkan
(NVIDIA) passes `f16-class` on the multilingual model. On CUDA the graph
dequantizes Q8_0 weights to F32 (the quantized-activation kernels lose this
model's outliers) and, in `strict`, F16 weights too, and `strict` computes
the RoPE tables on the host.
- `--decision-device auto` uses the GPU when there is one and falls back to
the CPU, with a warning, when the device fails to load, initialize or warm
up, or when CPU-only kernels are requested. A device whose weight buffer
cannot be allocated now fails the load (`gpu`) or falls back (`auto`)
instead of computing from host memory; `/props.decision.placement` counts
weights the device cannot run (`host_weights`), and
`--decision-strict-placement` refuses them. ROCm / MUSA builds, other
backends and quantized types other than Q8_0 load with a warning: they have
no parity run.
- `llama-laya-cli` gets `--plan packed|sequential` (default `packed`;
`sequential` runs one graph per question, as the server does),
`--jsonl FILE` (one load, one output line per input line), `--device`,
`--gpu`, `--strict-placement` and `--precision`.
- `LAYA_TRACE_DIR=<dir>` dumps the per-layer outputs of every forward pass
(`tools/laya/trace_diff.py` compares two dumps) for `llama-laya-cli` and
`llama-decision-bench`; the server honours it only with `--decision-debug`,
since the dump holds the activations of every request.
- Measured on servers: an RTX 4090 answers 13-24x faster at p50 than 32
threads of a 64-core EPYC on `laya-multilingual` F16 (systemone with one
question: 7.1 vs 93.8 ms), an RTX 5060 Ti 9-13x faster than 28 threads of
an EPYC 9334, and the decision process then uses almost no CPU. Use an F16
GGUF on a GPU: Q8_0 is not faster there. `DECISION.md` ("GPU backends") has
the tables and the recommendation. Macs are not measured yet, so the app
default stays `cpu`.
- `scripts/bench-decision-device.py`: paired CPU vs GPU bench (alternating
blocks, load and GPU sampling, time to ready, optionally a chat model
generating on the same GPU). `scripts/bench-decision-report.py --parity`
prints a speed number only when a passing parity gate of the same build,
GGUF and device covers it.
- **Laya decision model support** (`tools/laya`, `llama-laya-cli`), based on
upstream PR #29363: converter for `laya-multilingual`, GGUF arch `laya`, a
self-contained CPU graph, and a tokenizer that matches the HF tokenizer exactly.
Inputs follow the laya 0.3.21 PyTorch reference. On a 2605-question parity set
the F32 GGUF matches the reference to 6.6e-4 in scorer logits with identical
answers; F16 changes 2 answers, both near-ties.
- **English Laya checkpoints** `convaiinnovations/laya` (512 ctx) and
`laya-typed-decisions` (1024 ctx), ModernBERT-large encoder: the converter
handles them, `tools/laya` gets a second tokenizer (ModernBERT / OLMo
byte-level BPE with NFC, 0 mismatches against the HF tokenizer on 13.6k strings,
10.7k of them English-heavy), the special ids come from the tokenizer (`[CLS]`
50281, `[MASK]` 50284 with lstrip; a GGUF whose mask id is not
`laya.marker_token_id` no longer loads), and the checkpoint's
`temperature_by_options` buckets are stored in the GGUF and applied like the
reference. On 1491 English questions the F32 GGUFs match the PyTorch reference
with identical answers (max |dlogit| 4.2e-4 and 6.8e-5). F16 through the server
keeps every answer with the `blas` kernels, the macOS default (1.3e-2 and
4.6e-3); with the `default` ggml kernels, the Linux and Windows default, it
reaches 0.24 and 3.8e-2 with one near-tie answer change on `laya`
(`llama-laya-cli`, which packs the questions of an item: 0.44, two changes). About 2.2x the compute of `laya-multilingual` per token on an
M4 Max (router N=1 221 vs 111 ms at `-t 12`) and 944 vs 519 MiB footprint in
F16 (see `DECISION.md`, "English checkpoints").
`laya-multilingual` results are unchanged bit for bit with the `default`
kernels (`llama-laya-cli`, and the server with `--decision-kernels default`).
- **Model metadata `decision.spec`**, stamped into a GGUF without reconversion
with `gguf-py/gguf/scripts/gguf_decision_spec.py`. A calibration marked
required must cover every question type and option count, or the model does not
load.
- **`llama-decision-bench`** and `scripts/bench-decision.sh`: in-process latency
(p50/p95/p99 per phase), CPU seconds, memory and logits-hash determinism of
decision requests, plus server time-to-ready and first request after idle, with
the machine's power source and load recorded next to the numbers.
- **Router training and calibration tools** (`DECISION.md`, "Training and
calibration tools"): `tools/decision/reference.py`, a stdlib Python reference of
the router input (strict JSON, executor cards, `card-v1`, router state,
`escape-control` from the GGUF vocabulary), checked against the engine byte for
byte on 540 golden requests (`test-decision-reference`) and through the server's
render route; the card as JSON Schema; `scripts/fit-router-calibration.py`
(collects the server's raw router logits, fits the Platt `router.calibration`
block with bootstrap-interval ECE / Brier before and after, and prints the
`gguf_decision_spec.py` command instead of touching the GGUF); and
`scripts/router-baselines.py` (pass-rate heuristic and logistic regression on
card metrics, same data format and metrics).
- **Decision CPU levers** (laya engine): `token_embd` stays in a read-only file
mapping and the GGUF metadata is freed after the load (Q8_0 with the `default`
kernels: RSS 637 -> 262 MiB and footprint 764 -> 389 MiB after load; the macOS
default `auto` adds the BLAS backend, 408 MiB; results bitwise unchanged); one persistent ggml
threadpool; a warm-up pass at load (`--no-warmup` skips it); `--load-mode mlock`
/ `mmap+mlock` lock the model; the default thread count is the performance cores
(Windows: highest `EfficiencyClass`); `KMP_BLOCKTIME=0` / `OMP_WAIT_POLICY=passive`
unless set. New `--decision-kernels auto|default|repack|blas|repack+blas` (also
spec `plan.kernels`, shown in `/props.decision.plan.kernels`): `auto`, the new
default, uses the Accelerate BLAS backend on macOS, which is 2-2.3x faster, uses
3-4x fewer CPU seconds and is closer to the PyTorch reference than the ggml kernels
for F16 and Q8_0 (F16: 2604/2604 argmax agreement); `repack` enables
the CPU repack buffers for quantized weights. The BLAS backend runs with
min(`-t`, 8) threads (it starts new threads for every weight conversion; at
`-t 12`, 12 threads were up to 10% slower than 4 or 8 on `laya-multilingual`, and
4 was 3-5% slower than 8 on the larger English encoder). `llama-laya-cli` gets `--kernels`,
`--no-mmap` and `--mlock` and keeps the `default` kernels. `/props.decision`
also shows the BLAS threads and the weight bytes loaded / mapped / repacked.

- **Laya checkpoints without Python.** `llama-server --decision -m <dir>` and
`llama-laya-cli -m <dir>` take a laya Hugging Face checkpoint directory (an HF
snapshot works as it is). The first start converts it into a GGUF cache,
later starts reuse it ("converted" / "cache hit" in the log), and the cached
GGUF is loaded exactly like `-m FILE`. The cache lives in
`$LLAMA_CACHE/laya/gguf-cache` or the user cache (macOS
`~/Library/Caches/llama.cpp/laya/gguf-cache`, Linux `~/.cache/...`, Windows
`%LOCALAPPDATA%\...`), never in the checkpoint; new flags
`--decision-convert-cache DIR` and `--decision-convert-type f16|f32`
(default f16; the converter's q8_0 is not the precision-protected Q8_0 recipe,
use `tests/laya/quantize.sh` on the f16 GGUF). The cache key covers the
converter version, the outtype and the files the converter can read (root,
`encoder/`, `tokenizer/`; files up to 8 MiB by content, larger ones such as the
weights by size + mtime + symlink target). Writes are atomic and synced to disk.
`/props.decision` shows `source` (`gguf` / `checkpoint-dir`) and `cache_path`.
The conversion is the new `llama-laya-convert` (C++, no Python; also
usable on its own), byte-identical to `convert_hf_to_gguf.py` for all three
published checkpoints in f32, f16 and q8_0, with and without `--model-name`
(18 of 18 files), and 6-19x faster (0.2-1.8 s per f16 file). A first start of
`laya-multilingual` takes about 1.2-1.3 s instead of 0.3 s and peaks at about
515 MiB instead of 372 MiB RSS.

### Notes

- Decision mode runs on the CPU by default (`--decision-device cpu`); next to a
GPU chat server keep it there and start it with `--device none`.
- **Stricter laya GGUF checks**: a GGUF without `laya.attention.sliding_window`,
`laya.attention.sliding_window_pattern`, `laya.rope.freq_base` or
`laya.rope.freq_base_swa`, or with `laya.act_classes` below 1, no longer
loads. Every GGUF made by this converter has them; hand-made or older
third-party files may need reconversion.
- A laya GGUF started without `--decision` fails fast with a hint.
- **Decision server numerics on macOS change**: the default kernels there are now
`cpu+blas` (Accelerate), so macOS server logits differ slightly from Phase 1 and
from Linux and Windows, where `auto` stays on the ggml kernels and nothing
changes. `--decision-kernels default` restores the Phase 1 numerics bit for bit on
every platform. An explicit `--decision-kernels blas` fails at load on a
build without a BLAS backend.
- Recommended laya precision is F16: Q8_0 is about 1.5x faster but changes about
2% of answers on the parity set.
- Windows: decision model, spec and input paths may contain non-ASCII characters
(for example a Cyrillic user folder), and `llama-laya-cli` prints LF line ends on
every platform, so its output compares byte for byte with the golden files.
- A router calibration fitted with `scripts/fit-router-calibration.py` pins the
kernels its logits came from (`plan.kernels`): one fitted on a Mac pins `blas`
and needs a BLAS build elsewhere. Collect on the target platform, or start the
collecting server with `--decision-kernels default`.

### Changed

- **Qwen3.5 / Qwen3-Next / Kimi-Linear / Kimi-K3 / BailingMoeV3 numerics:** the
Gated DeltaNet q/k normalization now uses upstream's `rsqrt(sum(x^2) + eps)`
form (upstream 5fdfa6282). Logits of these models shift slightly; results
measured on earlier builds are not bit-identical.

## b10269-1.6.0

### Added
Expand Down
Loading
Loading