Compare commits

..
1 Commits
Author SHA1 Message Date
Deadcode fe12b49a61 Radiance 2.4.1
- Re-initialise kvstream residency maps and control counters on every rank after park->restore, and reset stream_prev_ so cumulative counter deltas start cleanly from zero.
- Streamline README and docs and update spec.md to 2.4.0.
2026-11-29 23:12:43 +01:00
27 changed files with 797 additions and 27220 deletions

No files matched your search

+1 -1
View File
@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.21)
# VERSION is the server release that /version reports. The plugin ABI version is separate and is
# read from abi/rad_abi.h below.
project(radiance VERSION 2.4.0 LANGUAGES C CXX)
project(radiance VERSION 2.4.1 LANGUAGES C CXX)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
+119 -404
View File
@@ -1,452 +1,167 @@
# radiance
An inference server for AMD GPUs, in C++ and HIP: language models, and image, video, speech and
music generation. Its HTTP API speaks OpenAI's chat, completions, Responses, images, audio and video
APIs, Anthropic's Messages API and llama-server's native one, so their clients and SDKs work
unchanged. Model architectures, kernel libraries and quantisers are `.so` plugins; the ones in this
tree are built and loaded the same way a third party's are ([`docs/PLUGIN.md`](docs/PLUGIN.md)).
An inference server for AMD GPUs written in C++20 and HIP. It serves language and vision-language models, embeddings, rerankers, speech recognition, text-to-speech, music, image, video and 3D generation behind one process and one port.
The bundled device kernels target AMD RDNA4 (`libr4d`: `gfx1200`, `gfx1201`), RDNA3 (`libr3d`:
`gfx11xx`) and Strix Halo (`libhalo`: `gfx1151`); EXL3-V3 trellis linears, for the Qwen3.5-3.8
dense and Gemma 4 dense architectures under `plugin/`, have a `gfx1201` library of their own
(`plugin/exl3i`). The serve settings
below are for two 32 GB cards (Radeon AI PRO R9700). The engine starts on any AMD GPU family;
another card needs a kernel library for it. A machine with no GPU builds the host backend, whose
AVX-512/AVX2 kernels (`libavx`) serve every model here: the small ones (EmbeddingGemma 2,
Qwen3-ASR, the 0.8B-3B models) at interactive speed on a desktop CPU, the 27B and larger far more
slowly than a card.
Its HTTP and WebSocket API speaks OpenAI (`/v1/chat/completions`, `/v1/completions`, `/v1/responses`, `/v1/embeddings`, `/v1/images/*`, `/v1/audio/*`, `/v1/videos`, `/v1/realtime`), Anthropic (`/v1/messages`), vLLM (`/v1/rerank`, `/metrics`, `/tokenize`) and llama-server (`/completion`, `/infill`, `/props`). Architectures, kernel libraries and quantisers are `.so` plugins using a stable C ABI ([`docs/PLUGIN.md`](docs/PLUGIN.md)).
To support the development of radiance: [Patreon](https://patreon.com/StillDeadCode).
**Hardware support:**
- **AMD RDNA4** (`gfx1200`, `gfx1201`, `gfx12-generic`): `libr4d`, plus `plugin/exl3i` (EXL3-V3 trellis linears) and `plugin/glm`.
- **AMD RDNA3 / 3.5** (`gfx11xx`, `gfx11-generic`, Strix Halo `gfx1151`): `libhalo` (WMMA) and `libr3d`.
- **CPU (x86-64)**: `libavx` (AVX-512 / AVX2+FMA / AVX / scalar) serves every model without a GPU.
## Models
Support development on [Patreon](https://patreon.com/StillDeadCode).
| model | container | get it | fleet file |
|---|---|---|---|
| Qwen3-VL 32B W4A8: writing and visual QA | `qwen3-vl-32b-instruct-abliterated-w4a8.rad` | [Convert](docs/QWEN3-VL.md) | [Fleet entry](docs/QWEN3-VL.md) |
| Qwen3.8-Flash-Next: IQR-V4 experts, int8 trunk, MTP, vision | `qwen3.8-next-flash-iqr-v4.rad` (113 GiB) | [download](https://huggingface.co/StillDeadcode/qwen3.8-next-flash-iqr-v4) | `tp1.yaml`, `tp2.yaml` |
| GLM-5.3-Flash: IQR-V4 experts, IQ8R trunk, int8 latent cache, four cards with the experts tiered to host memory | `glm53-flash-iqr-v4.rad` (159 GiB) | [download](https://huggingface.co/animusnull/glm-5.3-flash-iqr-v4) | `tp4.yaml` |
| DeepSeek-V4.1-Flash 1017 uncensored (refusals removed): llama.cpp's blocks at 2.83 bits a weight (its DSpark drafter's MXFP4 experts are not served), exact fp8 cache, two or four cards with the experts tiered to host memory ([docs/ARCHITECTURES.md](docs/ARCHITECTURES.md#deepseek41-deepseek-v41-flash)) | `deepseek-v4.1-flash-1017-uncensored.rad` (134 GiB of experts) | [download](https://huggingface.co/bakon3/DeepSeek-V4.1-Flash-1017-uncensored-rad) | — |
| Qwen3.8-Flash-Next abliterated (refusals removed): IQR-V4 trunk (GPTQ), codebook experts (round to nearest), MTP, vision | `qwen3.8-flash-next-uncensored-iqr-v4.rad` (113 GiB) | [download](https://huggingface.co/davetha/qwen3.8-flash-next-uncensored-iqr-v4) | — |
| Qwen3.8-Flash-Next: calibrated Q5 expert down (w5nl, group 64), BF16 PLE, vision | `qwen4exp-w5dn64-bf16ple-gptq.rad` (166 GiB) | [download](https://huggingface.co/gostar77/qwen3.8-flash-next-radiance-q5-w5dn64-bf16ple) | — |
| Qwen3.8-Flash-Next IQ5R-V4: U5 trunk, W5NL expert down, BF16 PLE and vision | `qwen3.8-flash-next-iq5r.rad` (175 GiB) | [download](https://huggingface.co/gostar77/qwen3.8-flash-next-iq5r-v4-u5-w5-bf16ple) | — |
| Qwen3.8-Flash-Next: U4 expert gate/up, W6NL expert down, BF16 PLE and vision | `qwen3.8-flash-next-u4-w6-bf16ple.rad` (170 GiB) | [download](https://huggingface.co/gostar77/qwen3.8-flash-next-u4-w6-bf16ple) | — |
| Qwen3.8-27B IQ8R (rotated int8), DFlash2 drafter, vision | `qwen3.8-27b-iq8r-dflash.rad` (29 GiB) | [download](https://huggingface.co/StillDeadcode/qwen3.8-27b-iq8r-dflash) | `tp2.yaml` |
| Qwen3.8-27B IQR-V4, 2.5 to 8 bits a weight ([docs/IQR.md](docs/IQR.md)), DFlash2 drafter, vision | `qwen3.8-27b-iq2r-v4.rad` .. `qwen3.8-27b-iq8r-v4.rad` (10 to 28 GiB) | [download](https://huggingface.co/StillDeadcode/qwen3.8-27b-iqr-v4) | `tp1.yaml` (IQ4R-L) |
| Hemmingway-1.5 (Qwen3.8-27B fine-tune) IQ4R-S, tool-tail GPTQ; this version serves the trunk, not the MTP block | `hemmingway-1.5-iq4r-s-tool-tail-mtp-gptq.rad` (14 GiB) | [download](https://huggingface.co/gostar77/hemmingway-1.5-iq4r-s-tool-tail-mtp-gptq) | — |
| Qwen3.6-35B-A3B IQ8R, MTP | `qwen3.6-35b-a3b-iq8r.rad` (35 GiB) | [download](https://huggingface.co/StillDeadcode/qwen3.6-35b-a3b-iq8r) | — |
| MiniCPM5-2B IQ8R, DSpark drafter | `minicpm5-2b-iq8r.rad` (3 GiB) | [download](https://huggingface.co/StillDeadcode/minicpm5-2b-iq8r) | `tp1.yaml`, `tp2.yaml` |
| MiniCPM5-2B bf16 (served without its drafter) | `minicpm5-2b-bf16.rad` (5 GiB) | [download](https://huggingface.co/StillDeadcode/minicpm5-2b-bf16) | — |
| Spark X2.6 4B bf16: thinking and tool calls, one to four cards | `spark-x2.6-4b-radiance-bf16.rad` (8.3 GiB), with DSpark `spark-x2.6-4b-radiance-bf16-dspark.rad` (10 GiB) | [download](https://huggingface.co/gostar77/spark-x2.6-4b-radiance) | — |
| Spark X2.6 4B IQ8R: rotated int8 trunk, optional bf16 head, layers 0-11 kept bf16, optional DSpark | `spark-x2.6-4b-radiance-iq8r-diverse.rad` .. `spark-x2.6-4b-radiance-iq8r-bf16-head-dspark.rad` (4.5 to 6.6 GiB) | [download](https://huggingface.co/gostar77/spark-x2.6-4b-radiance) | — |
| Hy-Memory-30B-A3B bf16 | `hy-memory-30b-a3b-bf16.rad` (56 GiB) | [download](https://huggingface.co/gostar77/hy-memory-30b-a3b-radiance) | — |
| Hy-Memory-30B-A3B W4 GPTQ: attention, dense MLP and routed experts | `hy-memory-30b-a3b-w4-gptq-full-1m.rad` (15 GiB) | [download](https://huggingface.co/gostar77/hy-memory-30b-a3b-radiance) | — |
| Gemma 4 31B EXL3-V3: 3.25 to 6.0 bits a weight (`mad` codebook), int8 `lm_head`, assistant head, vision, one, two or four cards (RDNA4) | `gemma4-31b-exl3-3.25bpw.rad` .. `gemma4-31b-exl3-6.0bpw.rad` (16.8 to 26.2 GiB) | [download](https://huggingface.co/keptn/gemma4-31b-exl3) | — |
| Gemma 4 31B Q8: int8 trunk and lm_head (Q8_0's grid at group 128), int8 DFlash drafter, vision | `gemma4-31b-dense-q8-df.rad` (33 GiB) | [convert](#convert-a-checkpoint) | — |
| Gemma 4 12B EXL3-V3: 3.25 to 6.0 bits a weight (`mad` codebook), 4-bit embedding in host RAM, int8 `lm_head`, assistant head, vision, audio, one or two cards (RDNA4) | `gemma4-12b-exl3-3.25bpw.rad` .. `gemma4-12b-exl3-6.0bpw.rad` (6.2 to 9.7 GiB) | [download](https://huggingface.co/keptn/gemma4-12b-exl3) | — |
| Qwen-Image 2.1 IQ8R: text to image and image edits | `qwen-image-2.1-iq8r.rad` (16 GiB) | [download](https://huggingface.co/StillDeadcode/radiance-qwen-image-2.1-iq8r) | `tp1.yaml`, `tp2.yaml` |
| Qwen-Image 2.1 Turbo IQ8R: the same in 8 steps | `qwen-image-2.1-turbo-iq8r.rad` (16 GiB) | [download](https://huggingface.co/StillDeadcode/radiance-qwen-image-2.1-turbo-iq8r) | — |
| Krea 2 Turbo IQ8R: text to image, one card | `krea-2-turbo-iq8r.rad` (16 GiB) | [download](https://huggingface.co/StillDeadcode/krea-2-turbo-radiance-iq8r) | — |
| Krea 2 Raw IQ8R: the same, undistilled | `krea-2-raw-iq8r.rad` (16 GiB) | [download](https://huggingface.co/StillDeadcode/krea-2-raw-radiance-iq8r) | — |
| FLUX.3 [klein] IQ8R: text to image and edits from up to ten pictures, one card | `flux-3-klein-iq8r.rad` (9.4 GiB) | [download](https://huggingface.co/StillDeadcode/radiance-flux-3-klein-iq8r) | — |
| FLUX.3 [klein] base IQ8R | `flux-3-klein-base-iq8r.rad` (9.3 GiB) | [download](https://huggingface.co/StillDeadcode/radiance-flux-3-klein-base-iq8r) | — |
| LTX-2.5 distilled IQ8R: video with its stereo soundtrack from text or a first frame, one card | `ltx-2.5-distilled-iq8r.rad` (37 GiB) | [download](https://huggingface.co/StillDeadcode/radiance-ltx-2.5-distilled-iq8r) | — |
| LTX-2.5 base IQ8R | `ltx-2.5-iq8r.rad` (37 GiB) | [download](https://huggingface.co/StillDeadcode/radiance-ltx-2.5-iq8r) | — |
| MiniMax-H3, int8 DiT: video with its stereo soundtrack from text | `minimax-h3-i8.rad` (63 GiB) | [download](https://huggingface.co/StillDeadcode/minimax-h3-i8) | `tp2.yaml` |
| FastH3 8-Step V2, int8 DiT: the same in eight steps | `fasth3-8-step-v2-i8.rad` (65 GiB) | [download](https://huggingface.co/StillDeadcode/fasth3-8-step-v2-i8) | — |
| MiniMax-Music3 bf16: songs from lyrics and a description | `minimax-music3-bf16.rad` (20 GiB) | [download](https://huggingface.co/StillDeadcode/minimax-music3-bf16) | `tp1.yaml`, `tp2.yaml` |
| Unlimited-OCR bf16: document parsing with the DeepEncoder tower | `unlimited-ocr-bf16.rad` (6.2 GiB) | [download](https://huggingface.co/Aijuus/unlimited-ocr-bf16) | — |
| Breeze-TTS-2 bf16: speech, whole, streamed or live, one card | `breeze-tts2-bf16.rad` (5.5 GiB) | [download](https://huggingface.co/StillDeadcode/radiance-breeze-tts2-bf16) | `tp1.yaml`, `tp2.yaml` |
| Fish Audio drama-3: speech with speaker tags and directions, two cards | `drama3-i8.rad` (37 GiB) | [convert](data/recipes/drama3-i8.recipe) | — |
| TranslateGemma 27B, int8 trunk: translation | `translategemma-27b-i8.rad` (28 GiB) | [download](https://huggingface.co/StillDeadcode/translategemma-27b-i8) | — |
| Qwen3.8-27B bf16 | `qwen3.8-27b-bf16.rad` (50 GiB) | [convert](#convert-a-checkpoint) | — |
| Qwen3.8-Flash-Next bf16, a disk-streamed reference | `qwen3.8-flash-next-bf16.rad` (335 GiB) | [convert](#convert-a-checkpoint) | — |
| Stable Diffusion XL bf16 and its finetunes (Illustrious, NoobAI, Pony): text to image, one card | `illustrious-xl-v2.0-bf16.rad` (6.4 GiB), from any single-file SDXL checkpoint | [convert](#convert-a-checkpoint) | — |
| EmbeddingGemma 2 bf16: text, image, video and audio embeddings, one card | `embeddinggemma2-bf16.rad` (1.4 GiB) | [convert](#convert-a-checkpoint) | `tp1.yaml`, `tp2.yaml` |
| nomic-embed-text-v2-moe bf16: text embeddings, one card | `nomic-embed-v2-moe-bf16.rad` (959 MB) | [convert](#convert-a-checkpoint) | — |
| LiquidAI LFM3-1.7B IQ8R: rotated int8 trunk, bf16 head; text, tool calls and reasoning, one card | `lfm3-1.7b-iq8r.rad` (2.5 GiB) | [convert](#convert-a-checkpoint) with `data/recipes/lfm3-1.7b-iq8r.recipe` | — |
| LiquidAI LFM3-1.7B bf16: text, tool calls and reasoning, one card | `lfm3-1.7b-bf16.rad` (3.8 GiB) | [convert](#convert-a-checkpoint) | — |
| Meta Muse Glimmer 30B bf16: text, images and video; sliding-window rotary layers between NoPE full ones, a windowed ViT | `muse-glimmer-30b-bf16.rad` (56 GiB) | [convert](#convert-a-checkpoint) | — |
| Meta Muse Glimmer 30B w4a8: int4 trunk, images and video, one card | `muse-glimmer-30b-w4a8.rad` (16 GiB) | [convert](#convert-a-checkpoint) | — |
| Meta Muse Glimmer 30B IQ8R: rotated int8 trunk, int8 head, DFlash drafter, images and video | `muse-glimmer-30b-iq8r-dflash.rad` (36 GiB) | [download](https://huggingface.co/StillDeadcode/muse-glimmer-30b-iq8r-dflash) | — |
| Meta Muse Glimmer 30B IQ4R-V4: trellis trunk, DFlash2, BF16 vision | `muse-glimmer-30b-iq4r-v4-df2.rad` (24 GiB) | [download](https://huggingface.co/gostar77/muse-glimmer-30b-iq4r-v4-radiance) | — |
| Meta Muse Glimmer 30B IQ4R-S-V4: smaller trellis trunk, DFlash2, BF16 vision | `muse-glimmer-30b-iq4r-s-v4-df2-bf16vision.rad` (19.6 GiB) | [download](https://huggingface.co/gostar77/muse-glimmer-30b-iq4r-s-v4-radiance) | — |
| Meta Muse Glimmer 30B IQ4R-S-V4, int8 vision (needs [#564](https://codeberg.org/StillDeadcode/radiance/pulls/564)) | `muse-glimmer-30b-iq4r-s-v4-df2-i8vision.rad` (17.8 GiB) | [download](https://huggingface.co/gostar77/muse-glimmer-30b-iq4r-s-v4-radiance) | — |
| Recursive Flint (39.8B, about 2.5B active) IQ8R: rotated int8 trunk and experts, two cards | `flint-iq8r.rad` (38 GiB) | [download](https://huggingface.co/StillDeadcode/flint-iq8r) | — |
| Ling-3.0-tiny IQ8R: rotated int8 trunk and experts, one card | `ling-3.0-tiny-iq8r.rad` (7.9 GiB) | [download](https://huggingface.co/StillDeadcode/ling-3.0-tiny-iq8r) | — |
| NVIDIA Nemotron-3.5-Bolt-74B-A9B 2-bit: NVIDIA's IQ2_XXS experts and Q8_0 linears as stored, IQ8R Mamba projections, LiLiCorr drafter, one card | `nemotron74-2bit.rad` (26.66 GiB of weights) | [convert](data/recipes/nemotron74-nvidia-24gb-iq8r.recipe) | — |
| NVIDIA Nemotron-3.5-Bolt-E4B EXL3-V3: 4.07 or 6.0 bits a weight (`mad` codebook), 5-bit PLE in host RAM, int8 `lm_head`, int8 DFlash drafter, vision, audio, one or two cards (RDNA4) | `nemotron-3.5-bolt-e4b-exl3-4.07bpw.rad` (7.5 GiB), `nemotron-3.5-bolt-e4b-exl3-6.0bpw.rad` (8.3 GiB) | [download](https://huggingface.co/keptn/nemotron-3.5-bolt-e4b-exl3) | — |
| Nemotron 3.5 Embed 1B BF16: text and image embeddings, one card | the checkpoint as it ships | [NVIDIA checkpoint](https://huggingface.co/nvidia/Nemotron-3.5-Embed-1B-BF16) | — |
| Nemotron 3.5 Embed 8B BF16: text and image embeddings, one card | the checkpoint as it ships | [NVIDIA checkpoint](https://huggingface.co/nvidia/Nemotron-3.5-Embed-8B-BF16) | — |
| Nemotron 3.5 Rerank 8B BF16: text/image document relevance, one card | the checkpoint as it ships | [NVIDIA checkpoint](https://huggingface.co/nvidia/Nemotron-3.5-Rerank-8B-BF16) | `tp1.yaml`, `tp2.yaml` |
| Qwen3-ASR 1.7B bf16: speech to text, `/v1/audio/transcriptions` and live over `/v1/realtime`, 30 languages, one card | the checkpoint as it ships (4.1 GiB) | [Qwen/Qwen3-ASR-1.7B-hf](https://huggingface.co/Qwen/Qwen3-ASR-1.7B-hf) | `tp1.yaml`, `tp2.yaml` |
| Qwen3-Embedding (0.6B, 4B, 8B) bf16: text embeddings, one card | the checkpoint as it ships | [Qwen checkpoint](https://huggingface.co/collections/Qwen/qwen3-embedding) | `tp1.yaml` |
| Qwen3-Reranker (0.6B, 4B, 8B) bf16: text document relevance, one card | the checkpoint as it ships | [Qwen checkpoint](https://huggingface.co/collections/Qwen/qwen3-reranker) | `tp1.yaml` |
| Inkling 2 Mini IQ4R-V4 + DFlash2: the experts IQR-V4's four-bit computed trellis (GPTQ against recorded Hessians), the attention and the head rotated int8, the embedding int8, incoai's DFlash2 drafter (four-bit computed trellis, down int8), the vision tower bf16; text and images, one or two cards (`draft-window: adaptive`) ([geometry](docs/ARCHITECTURES.md#inkling2-inkling-2-mini)) | `inkling-2-mini-iq4r-v4.rad` (14.43 GiB) | [download](https://huggingface.co/StillDeadcode/inkling-2-mini-iq4r-v4) · [convert](data/recipes/inkling2-mini-iq4r-v4.recipe) | — |
---
**Not served by this version.** A container whose weights are block FP8, MXFP4, M2XFP4 or
ParoQuant, or whose experts read E4M3 activations, is refused at startup by the name of the first
such weight. That is every FP8 and MXFP4 container of the models above, and the models that have
no int8 container yet: Ornith-1.5 (35B-A3B and 122B), Sage-A1.5, Ling-3.0-flash-Sante and
Anima's FP8 container (Anima converted to bf16 is served). Each returns with an int8 container.
A container with an int8 or bf16 trunk and a block-FP8 drafter (NVIDIA-Nemotron-3.5-Bolt-E4B,
the Gemma 4 31B DFlash and DFlash2 containers, MiniCPM5-2B bf16), or with GGUF blocks and an
MXFP4 drafter (the DeepSeek-V4.1-Flash container's DSpark), serves without the drafter under
`num-speculative-tokens: 0`.
## Quick Start (Docker)
A container holds everything the server needs: the weights, the tokeniser, the chat template and
any drafter. Each download link's repository has the recipe and the exact command that made the
file. Download one into your models directory (the transfer resumes if interrupted):
The host needs Docker and an `amdgpu` kernel driver supporting ROCm 10.1 (no host ROCm install required). Enable **Above 4G Decoding** and **Resizable BAR** in firmware for full performance.
```sh
mkdir -p /srv/models/rad && cd /srv/models/rad
curl -LC - -O https://huggingface.co/StillDeadcode/minicpm5-2b-iq8r/resolve/main/minicpm5-2b-iq8r.rad
```
The Gemma 4 and Nemotron-3.5-Bolt-E4B EXL3-V3 containers are keptn42's (codebook `mad`, RDNA4
`exl3i` kernels; each repository has the recipes, speed and KL tables). To convert Google's bf16
Gemma 4 31B checkpoint yourself without EXL3, `data/recipes/gemma4-31b-dense-bf16-w4a8.recipe`
quantises without calibration (round-to-nearest with a scale search, bf16 lm_head); see
[Convert a checkpoint](#convert-a-checkpoint).
TranslateGemma 27B is converted from Google's bf16 checkpoint with
`data/recipes/translategemma-27b-i8a8.recipe`, an int8 trunk rounded without calibration data.
Its chat template takes structured turns
naming the two languages and refuses the plain turn the server renders at startup, so its entry
serves a plain Gemma 3 template, `deploy/compose/gemma3.jinja` (`override-chat-template` names it;
in a compose file, mount it into the container), and a client sends on `/v1/completions` the prompt
the checkpoint's template renders.
The Qwen-Image containers serve OpenAI's images API (`/v1/images/generations`, `/v1/images/edits`):
pictures from a prompt, and edits of up to ten pictures with an optional mask, 2048x2048 by default.
On two R9700s a 2048x2048 picture takes 61 s at the base model's 40 steps and 13 s with Turbo (56 and
12 s with `tp-wire: wht6`); 1024x1024 takes 6 s and 2.6 s. Qwen-Image 2.1 is under Qwen's research
license, which is non-commercial. Krea 2 is under the Krea 2 Community License and Krea's
acceptable use policy, FLUX.3 [klein] under the FLUX Kommunity License (non-commercial use),
LTX-2.5 under the LTX-2.x Community License, and an SDXL finetune under its checkpoint's own
license.
The MiniMax-H3 containers serve OpenAI's video jobs (`/v1/videos`): a video with its stereo
soundtrack from a prompt, 5 to 14 s, up to 1344x768. On two R9700s a 5.17 s clip at 1344x768 takes
about 68 s with FastH3 and 8.8 minutes at MiniMax-H3's 50 steps; both read about 39 GiB of pinned
host memory. With LBH-123-AI's latent upscaler in the container, `"latent_upscale": 2` runs the first
steps at half the size and refines at the full size: MiniMax-H3's clip then takes 3.4 minutes
(docs/GUIDE.md §5.16). A ComfyUI node, `integrations/comfyui/ComfyUI-Radiance-MiniMax`, renders
through `/v1/videos` from a ComfyUI graph as a client of the server. MiniMax-H3's license, which
FastH3 carries, does not cover the EU, the UK, the Republic of Korea or the USA.
MiniMax-Music3 and Breeze-TTS-2 answer `/v1/audio/speech`, whole or streamed as they are made: a song
from lyrics and a description, 44.1 kHz stereo, made at about the speed it plays on two cards; and
speech in a voice the request describes, made in 0.6 of its playing time on one card, its first
streamed audio 0.21 s after the request. Breeze-TTS-2 also speaks text while it is being written,
over the `/v1/audio/speech/stream` WebSocket; it is licensed for research and non-commercial use
only. Fish Audio's drama-3 speaks a script whose speakers and direction are written in it
(`<|speaker:1|>`, `[laughs]`), each speaker in the model's voice or one cloned from a reference
clip and its transcript, at 0.3 of its playing time on two cards, its first streamed audio
0.23 s after the request; under the Fish Audio Community License a service that lets others
generate speech with it needs a licence from Fish Audio, and imitating a real person's voice needs
their consent.
## Run with Docker
The host needs Docker and an `amdgpu` driver that supports ROCm 10.1; it does not need ROCm. The
card works best with Resizable BAR on (Above 4G Decoding and Resizable BAR in the firmware setup);
without it the engine keeps kernel arguments in pinned host memory, and every dispatch reads them
over the link. The image
is [`stilldeadcode/radiance`](https://hub.docker.com/r/stilldeadcode/radiance), with its kernels
built for `gfx1201` and `gfx12-generic` (RDNA4), `gfx11-generic` (RDNA3) and `gfx1151` (Strix
Halo). Pull it, clone this repository for its compose files, then start one of them:
The [`stilldeadcode/radiance`](https://hub.docker.com/r/stilldeadcode/radiance) image bundles kernels for `gfx1201`, `gfx12-generic`, `gfx11-generic` and `gfx1151`:
```sh
docker pull stilldeadcode/radiance
git clone https://codeberg.org/StillDeadcode/radiance.git
cp -r radiance/deploy/compose ~/radiance-compose && cd ~/radiance-compose
cp .env.example .env # set RADIANCE_MODELS, RADIANCE_API_KEY, the GIDs
docker compose -f tp2.yaml up -d # two cards; tp1.yaml for one (RADIANCE_GPU), tp4.yaml for four
docker compose -f tp2.yaml logs -f
docker compose -f tp2.yaml down
cp .env.example .env # set RADIANCE_MODELS, RADIANCE_API_KEY, device GIDs
docker compose -f tp2.yaml up -d # tp1.yaml for 1 card, tp2.yaml for 2, tp4.yaml for 4
```
A file serves all its models from one container behind one port, and brings a model onto the cards
when a request names it ([`docs/MULTIMODEL.md`](docs/MULTIMODEL.md)): a request's `model` is the
entry's name (`flashnext`, `qwen3.8-27b`, `minicpm5-2b`, ...). The entries are in
`tp1.radiance.yaml`, `tp2.radiance.yaml` and `tp4.radiance.yaml` beside the compose files, the server's configuration as
it reads it. Delete the entries of the containers
you do not have; any other model from the table is added as an entry with its keys from the table
under [Run without Docker](#run-without-docker). The two files take the same port, so run one at a
time. Running without compose, and the reason for each `docker run` option, is in
[`docs/DOCKER.md`](docs/DOCKER.md).
Each compose file serves multiple models behind one port, loading and swapping them on demand ([`docs/MULTIMODEL.md`](docs/MULTIMODEL.md)). Edit the matching `tp*.radiance.yaml` to keep only the models you have. See [`docs/DOCKER.md`](docs/DOCKER.md) for standalone `docker run` and custom `docker/build.sh` targets.
To build the image yourself, for example for other cards, run `docker/build.sh -t 'gfx1200;gfx1201'`
in the clone (it needs `docker buildx` and tests the build as it goes). Then set
`RADIANCE_IMAGE=radiance:latest` in `.env`.
## Build from source
You need Linux, git, a C++20 compiler, CMake 3.21+ and Ninja. For the device kernels you also need
ROCm 10.1 or 7.2 (`hipcc`; set `ROCM_PATH` if it is not `/opt/rocm`).
The C++20 compiler is tested with the clang included in the ROCm 10.1 distribution; other
compilers may produce compile errors in the C++ architecture plugins. Pull requests for
cross-compiler build issues are not accepted.
Clone the repository and build in it:
```sh
git clone https://codeberg.org/StillDeadcode/radiance.git && cd radiance
./build.sh # configure, build for the cards present, run the fast tests
./build.sh --no-hip # host backend only
cmake -S . -B build -G Ninja -DRAD_GPU_TARGETS='gfx1201' # build for cards this machine lacks
```
To install, name the prefix when the build directory is first configured
(`-DCMAKE_INSTALL_PREFIX=/opt/radiance`), build, then run `cmake --install build`. The default
plugin path, `<prefix>/share/radiance`, is compiled in from that first configure, so
`cmake --install build --prefix DIR` alone gives a tree that looks for its plugins elsewhere. The
prefix gets `bin/`, `include/radiance/`, `lib/cmake/radiance/`, `libexec/radiance/`,
`share/radiance/` and `share/doc/radiance/`.
With ROCm 10.1 the build turns the compiler's VOPD pairing (dual-issue instruction pairs) off: its
LLVM 24 pairs in an order that follows heap addresses, so two builds of the same source can differ.
The Docker image builds its compiler with the fix and keeps the pairing, which is 1.4-3.5% faster
on prefill GEMMs; a compiler that has the same fix is declared with
`-DRAD_HIP_VOPD_REPEATABLE=ON`. ROCm 7.2 is unaffected.
## Run without Docker
The server reads its settings from a YAML file: `server:` holds the listener, `memory:` the
per-card VRAM budget, and `models:` one entry whose name is the model id requests use. Every key
is named as in the [`docs/GUIDE.md`](docs/GUIDE.md) §4.11 reference; `radiance --help` prints it.
```yaml
# radiance.yaml
server:
port: 8000
models:
minicpm5-2b-iq8r:
model: /srv/models/rad/minicpm5-2b-iq8r.rad # or a Hugging Face repo id: StillDeadcode/minicpm5-2b-iq8r
```
```sh
export RADIANCE_HOME=$PWD/build/radiance_home # the plugins; an install finds its own
build/bin/radiance --config radiance.yaml --check # validate the file, serve nothing
build/bin/radiance --config radiance.yaml
```
`model` also takes a Hugging Face repo id, as vLLM does. The server fetches the repo with `curl`
and `jq` (`scripts/hfget.sh`) into `~/.cache/radiance/hf` (`server.download-dir` puts it elsewhere),
serves the container it holds, and checks it for changes at every start; a start that cannot reach
the hub serves the copy it has. The Docker image carries both tools; in a container,
`server.download-dir` must name a writable mount, since the compose files mount `/models` read-only.
The server takes no other command-line options. A command line written for an earlier release
(`radiance --model ... --tp 2`) is refused with the same settings printed as YAML, and
`rad-yaml FLAGS...` prints that file without starting anything:
`rad-yaml --model x.rad --tp 2 > radiance.yaml`. [`docs/MULTIMODEL.md`](docs/MULTIMODEL.md) §4
describes the file's levels.
Each row holds the keys a model is served with in a file of its own (the Flash-Next rows leave out
`prefix-cache-mib`). They go under the model's entry, except `gpu-headroom-mib`, which goes under
`memory:` and in a file of several models holds for all of them. `tp1.radiance.yaml` and
`tp2.radiance.yaml` carry their models' entries as set for sharing the cards; a model added to either takes its row from
here.
| model | keys |
|---|---|
| Qwen3.8-Flash-Next | `tp: 2, tp-wire: wht6, max-num-seqs: 8, max-model-len: 200000, placement: expert_tiered, host-pool-mib: 24576, gpu-headroom-mib: 96, kv-cache-dtype: i8, num-speculative-tokens: 3, max-num-batched-tokens: 2048` |
| Qwen3.8-Flash-Next, one card | `tp: 1, max-num-seqs: 4, max-model-len: 200000, placement: expert_tiered, host-pool-mib: 43000, gpu-headroom-mib: 96, kv-cache-dtype: i8, num-speculative-tokens: 3, max-num-batched-tokens: 4096, checkpoint-interval: 4096` |
| Qwen3.8-Flash-Next, four ranks | `tp: 4, max-num-seqs: 8, max-model-len: 200000, placement: expert_tiered, host-pool-mib: 49152, gpu-headroom-mib: 96, kv-cache-dtype: i8, num-speculative-tokens: 3, max-num-batched-tokens: 2048` |
| Qwen3.8-Flash-Next, three ranks (the shipped container as it is, [`docs/TP3.md`](docs/TP3.md)) | `tp: 3, max-num-seqs: 8, max-model-len: 200000, placement: expert_tiered, host-pool-mib: 24576, gpu-headroom-mib: 96, kv-cache-dtype: i8, num-speculative-tokens: 3, max-num-batched-tokens: 2048` |
| GLM-5.3-Flash | `tp: 4, placement: expert_tiered, host-pool-mib: 65536, max-num-seqs: 4, max-model-len: 262144, max-num-batched-tokens: 2048, kv-cache-dtype: i8, num-speculative-tokens: 0, prefill-interleave: 4, prefix-cache-mib: 32768, gpu-headroom-mib: 96`, and `server.kernels: glm,libr4d,libavx,libref` |
| DeepSeek-V4.1-Flash | `tp: 2, max-num-seqs: 4, max-model-len: 262144, placement: expert_tiered, host-pool-mib: 73728, gpu-headroom-mib: 96, kv-cache-dtype: fp8, ngram-placement: disk, prefix-resume: nearest, num-speculative-tokens: 16, spec-ngram: 16, spec-ngram-max: 8, draft-window: adaptive, max-num-batched-tokens: 2048, expert-profile: data/deepseek41-expert-profile.json, chat-template-kwargs: {"enable_thinking":false}`; four cards: `tp: 4, host-pool-mib: 16384`, and on cards with unequal links `expert-split` ([docs/ARCHITECTURES.md](docs/ARCHITECTURES.md#deepseek41-deepseek-v41-flash)) |
| Qwen3.8-27B IQ8R and IQR-V4, Qwen3.6-35B-A3B | `tp: 2, max-num-seqs: 32, max-model-len: 200000, kv-cache-dtype: i8` |
| Qwen3.8-27B bf16 | `tp: 2, max-num-seqs: 8, max-model-len: 200000, kv-cache-dtype: i8` |
| MiniCPM5-2B IQ8R and bf16 | `tp: 2, max-num-seqs: 32, max-model-len: 131072, kv-cache-dtype: i8, gpu-headroom-mib: 160, max-num-batched-tokens: 512` |
| Qwen3.8-Flash-Next bf16 | `tp: 2, max-model-len: 32768, placement: expert_tiered, weights-disk-tier: true, host-pool-mib: 24576, gpu-headroom-mib: 768, deterministic: true, max-num-seqs: 32, max-num-batched-tokens: 32768, num-speculative-tokens: 0` |
| Qwen-Image 2.1 and 2.1 Turbo | `tp: 2, tp-wire: wht6` |
| MiniMax-H3 and FastH3 | `tp: 2, vision-tower-placement: ram` |
| MiniMax-Music3 | `tp: 2`, or `tp: 1` (20.5 GiB of weights on the card) |
| Breeze-TTS-2 | `tp: 1` |
| Gemma 4 31B EXL3-V3 | `tp: 2, max-num-seqs: 8, max-model-len: 262144, kv-cache-dtype: i8, vision-tower-placement: ram, num-speculative-tokens: 6, draft-window: adaptive, max-num-batched-tokens: 2048, temp: 1.0, top-p: 0.95, top-k: 64`; `tp: 1` (up to 4.89 bpw) or `tp: 4` |
| Gemma 4 31B Q8 | `tp: 2, max-num-seqs: 8, max-model-len: 65536, kv-cache-dtype: i8, num-speculative-tokens: 0, max-num-batched-tokens: 2048, temp: 1.0, top-p: 0.95, top-k: 64` |
| Gemma 4 12B EXL3-V3 | `tp: 1, max-num-seqs: 8, max-model-len: 262144, kv-cache-dtype: i8, vision-tower-placement: ram, num-speculative-tokens: 6, draft-window: adaptive, max-num-batched-tokens: 2048, temp: 1.0, top-p: 0.95, top-k: 64`; `tp: 2` on two cards |
| NVIDIA-Nemotron-3.5-Bolt-E4B EXL3-V3 | `tp: 1, max-num-seqs: 8, max-model-len: 65536, kv-cache-dtype: i8, num-speculative-tokens: 7, temp: 1.0, top-p: 0.95, top-k: 64`; `tp: 2` on two cards |
| TranslateGemma 27B | `tp: 2, max-num-seqs: 8, max-model-len: 16384, kv-cache-dtype: i8`, and `override-chat-template` naming `deploy/compose/gemma3.jinja` |
| Unlimited-OCR | `tp: 1, max-num-seqs: 8, max-model-len: 32768, kv-cache-dtype: i8, gpu-headroom-mib: 96`, and `override-chat-template` naming `deploy/chat-templates/unlimited-ocr-parser.jinja` (`/chat-templates/unlimited-ocr-parser.jinja` in the compose files' container) |
| Krea 2 Turbo and Raw, FLUX.3 [klein] and its base, Stable Diffusion XL | `tp: 1` |
| LTX-2.5 distilled and base | `tp: 1, vision-tower-placement: ram` |
| EmbeddingGemma 2 | `tp: 1, max-num-seqs: 64, max-num-batched-tokens: 8192` |
| Qwen3-ASR 1.7B | `tp: 1, max-num-seqs: 16` |
The 27B in IQ8R and IQR-V4, the 35B-A3B, MiniCPM5 and the Flash-Next bf16 reference run at up to
32 sequences a step. The other Flash-Next rows and the 27B in bf16 keep 8, the one-card Flash-Next
row 4: on a hybrid model each sequence holds its own recurrent state, and 32 of them take that
memory from the attention cache and, on Flash-Next, from the expert slab. See
[`docs/GUIDE.md`](docs/GUIDE.md) §4.4.
On one card a Flash-Next prefill step copies every pooled expert across the link once, so a
4096-token step shares that copy among twice the tokens of a 2048-token one (26K-token prompts:
2545 against 1413 tok/s); the checkpoint interval matches the step because a prefill chunk never
crosses a checkpoint. At 4 sequences that row's cache holds 301K tokens. The Flash-Next bf16 row
is a reference to calibrate and compare against, a step taking tens of seconds whatever its size;
its 32K of context keeps QSA's score plane for a 32K-token step at 1 GiB.
At `tp: 4`, decode and verify steps carry the exact all-reduce in the gated residual's write, with
the MoE gather in front of it; a prefill chunk runs the unfused chain. That chain's exact
all-reduce is one-shot up to 1 MiB a message and two-shot above, which sends half the bytes on a
prefill chunk; both produce the same bits. The four-rank row runs exact. At three and four ranks
`tp-wire: wht6` selects a different lossy wire, tiered int8 over the two-shot, above
`tp-wire-min-kb`. Eight ranks have no lossy wire, so `tp: 8` with `tp-wire: wht6` stops at startup
naming the all-reduce.
Four ranks is a capacity configuration: its per-step rate against `tp: 2` on the same cards has
not been measured, and its tiering keys are the two-rank recipe carried over. As at two ranks, each
rank owns a slice of every expert's width: each parity's 128-column blocks are cut contiguously over
the ranks and the odd block alternates with the parity, so every rank's share is whole blocks and
every block has one owner. The resident expert bytes per rank are smaller, so the elastic window
has a different shape: read the boot log's `elastic` line and re-derive `host-pool-mib` before
trusting it.
`host-pool-mib` is what a model pins for its weights in all, each rank an equal share: the
four-rank row pins 48 GiB of RAM (12 GiB a rank) that nothing else can use and the kernel cannot
swap out. The amdgpu driver caps what all processes
together pin at the machine's RAM less 1/64 and 1.5 GiB; the pool is locked user memory, which
`ttm.pages_limit` does not count. A 64 GiB machine serves the one-card Flash-Next row alone, with
`prefix-cache-mib: 4096`, at about 49 GiB pinned ([`docs/GUIDE.md`](docs/GUIDE.md) §7). In
`tp1.yaml` its entry carries `prefix-cache-mib: 1024` so its host pins fit such a host beside the
8 GiB the fleet keeps free; there it is unloaded when another model loads, and on a 61 GB host it
answered its next request after 17 to 19 s, loaded from its container again.
The Gemma 4 rows sample as the checkpoint's `generation_config` states, and a request switches
thinking (`chat_template_kwargs`). `vision-tower-placement: ram` keeps the vision tower in host
memory, so its VRAM goes to the KV cache. On one card, Gemma 4 31B EXL3-V3 holds up to 202,384
tokens of context at 4.89 bpw and 6.0 bpw does not fit; two and four cards hold full 262,144-token
context across 8 sequences. The Bolt-E4B EXL3-V3 container ships an int8 DFlash drafter trained on
blocks of 8 (`num-speculative-tokens: 7`); older Bolt-E4B containers with a block-FP8 drafter need
`num-speculative-tokens: 0`.
EmbeddingGemma 2 takes an input in one step, so its `max-num-batched-tokens` is the longest input
as well as the batch. A live Qwen3-ASR session holds one sequence, so its `max-num-seqs` is the
most sessions served at once. On one card LTX-2.5's adapter slots fit at `max-lora-rank: 16,
max-loras: 1` (433 MiB).
In a file of several models, Qwen-Image's grant counts two sequences of `max-model-len` tokens of
cache, which at the model's own 33600 tokens is 55.8 GiB on one card and 32.6 GiB a card on two,
more than the cards. `tp1.yaml` sets `max-model-len: 8192` (it needs 29.7 GiB; pictures up to
about 1.9 megapixels, 1024x1024 being 4096 tokens) and `tp2.yaml` `20480` (25.4 GiB a card; the
default 2048x2048 is 16384 tokens). Alone in a file it loads at its own length, its cache taking
what the cards have left. It sizes its buffers itself and warns that it does not take
`image-gen-max-pixels` or `image-gen-max-refs`.
Add `server.api-key: KEY` (or `server.api-key-env: VAR`, which reads it from the environment) to
require `Authorization: Bearer KEY` (or `X-Api-Key: KEY`). `debug-graph: true` on the model
prints every op and the kernel it resolved to, then exits without serving. A chat request:
Send a request or open the web dashboard at `http://localhost:8000/`:
```sh
curl -s localhost:8000/v1/chat/completions -H 'Content-Type: application/json' \
-d '{"model":"minicpm5-2b-iq8r","messages":[{"role":"user","content":"hi"}],"max_tokens":50}'
```
An image model answers OpenAI's images API instead, with base64 pictures:
---
## Build from Source
Requires Linux, git, CMake 3.21+, Ninja, and C++20 (tested with the `clang` shipped in ROCm 10.1; ROCm 7.2 is also supported; set `ROCM_PATH` if not `/opt/rocm`).
```sh
curl -s localhost:8000/v1/images/generations -H 'Content-Type: application/json' \
-d '{"prompt":"a lighthouse on a cliff at sunset, oil painting","size":"1024x1024"}' \
| python3 -c 'import sys,json,base64; open("out.png","wb").write(base64.b64decode(json.load(sys.stdin)["data"][0]["b64_json"]))'
git clone https://codeberg.org/StillDeadcode/radiance.git && cd radiance
./build.sh # build for attached GPUs + fast tests
./build.sh --no-hip # host CPU backend only
cmake -S . -B build -G Ninja -DRAD_GPU_TARGETS='gfx1201' # cross-compile for specific targets
```
`http://localhost:8000/` is the dashboard. [`docs/GUIDE.md`](docs/GUIDE.md) covers the API, memory
budgets, long context, speculative decoding and operating a server.
To install, set `-DCMAKE_INSTALL_PREFIX=/opt/radiance` at initial configure time and run `cmake --install build`. (The compiled-in plugin search path comes from that prefix; from a build tree, set `RADIANCE_HOME=$PWD/build/radiance_home`.)
## Convert a checkpoint
Create a `radiance.yaml` (see [`docs/GUIDE.md`](docs/GUIDE.md) and [`docs/MULTIMODEL.md`](docs/MULTIMODEL.md) for all keys):
`rad-convert` turns a Hugging Face checkpoint into a container, quantising what a recipe in
`data/recipes/` names. Download checkpoints with `scripts/hfget.sh <org/repo> <dir>`.
```yaml
server:
port: 8000
models:
minicpm5-2b-iq8r:
model: StillDeadcode/minicpm5-2b-iq8r # local .rad, HF checkpoint dir, or HF repo id
```
```sh
# Spark X2.6 uses the checkpoint's BF16 weights, tokenizer and chat template; no recipe required.
export RADIANCE_HOME=$PWD/build/radiance_home
build/bin/radiance --config radiance.yaml --check
build/bin/radiance --config radiance.yaml
```
> Migrating from pre-2.0 CLI flags? Run `rad-yaml --model x.rad --tp 2 > radiance.yaml` to convert them.
---
## Supported Models
Radiance serves self-contained `.rad` containers (weights, tokenizer, chat template, and optional drafter/vision tower) as well as unquantised Hugging Face checkpoints directly. Ready-to-run containers and recipes are listed below; full architecture details live in [`docs/ARCHITECTURES.md`](docs/ARCHITECTURES.md).
### Text & Multimodal LLMs
| Family | Notable Models & Modalities | Pre-built Containers / Conversion |
|---|---|---|
| **Qwen3.5 / 3.6 / 3.8** | Qwen3.8-27B (vision, DFlash2), Qwen3.6-35B-A3B MoE (MTP), Qwen3.8-Flash-Next MoE (vision, MTP), Qwen3-VL 32B | [Flash-Next IQR-V4](https://huggingface.co/StillDeadcode/qwen3.8-next-flash-iqr-v4) · [27B IQ8R](https://huggingface.co/StillDeadcode/qwen3.8-27b-iq8r-dflash) · [27B IQR-V4](https://huggingface.co/StillDeadcode/qwen3.8-27b-iqr-v4) · [35B-A3B IQ8R](https://huggingface.co/StillDeadcode/qwen3.6-35b-a3b-iq8r) |
| **Gemma 3 & 4** | Gemma 4 12B / 26B-A4B MoE / 31B (vision, audio on E2B/E4B, DFlash2/MTP), TranslateGemma 27B | [31B EXL3-V3](https://huggingface.co/keptn/gemma4-31b-exl3) · [12B EXL3-V3](https://huggingface.co/keptn/gemma4-12b-exl3) · [TranslateGemma 27B](https://huggingface.co/StillDeadcode/translategemma-27b-i8) |
| **GLM-5.3 / DeepSeek-V4.1 / ERNIE-5.5** | GLM-5.3-Flash (vision, MTP), DeepSeek-V4.1-Flash (vision, DSpark), ERNIE-5.5-Flash-Preview (DSpark) | [GLM-5.3 IQR-V4](https://huggingface.co/animusnull/glm-5.3-flash-iqr-v4) · [DeepSeek-V4.1](https://huggingface.co/bakon3/DeepSeek-V4.1-Flash-1017-uncensored-rad) · `rad-convert` |
| **Nemotron / Ling / Inkling / Flint** | Nemotron-3.5-Bolt 74B-A9B & E4B, Ling-3.0-tiny, Inkling 2 Mini (vision, DFlash2), Recursive Flint | [Inkling 2 Mini IQR-V4](https://huggingface.co/StillDeadcode/inkling-2-mini-iq4r-v4) · [Bolt-E4B EXL3](https://huggingface.co/keptn/nemotron-3.5-bolt-e4b-exl3) · [Flint IQ8R](https://huggingface.co/StillDeadcode/flint-iq8r) · [Ling-3.0-tiny](https://huggingface.co/StillDeadcode/ling-3.0-tiny-iq8r) |
| **MiniCPM / Spark / Muse / LFM / Hy-Memory** | MiniCPM5-2B (DSpark), Spark X2.6 4B (DSpark), Meta Muse Glimmer 30B (vision/video, DFlash2), LFM2/LFM3, Hy-Memory-30B-A3B | [MiniCPM5-2B IQ8R](https://huggingface.co/StillDeadcode/minicpm5-2b-iq8r) · [Muse Glimmer IQ8R](https://huggingface.co/StillDeadcode/muse-glimmer-30b-iq8r-dflash) · [Spark X2.6](https://huggingface.co/gostar77/spark-x2.6-4b-radiance) · [Hy-Memory](https://huggingface.co/gostar77/hy-memory-30b-a3b-radiance) |
| **OCR & Decision** | Unlimited-OCR, Cloudflare Clef, Convai Laya | [Unlimited-OCR](https://huggingface.co/Aijuus/unlimited-ocr-bf16) · `rad-convert` |
### Image, Video, Audio & 3D Generation
| Modality | Models | Pre-built Containers / Conversion |
|---|---|---|
| **Image** (`/v1/images/*`) | Qwen-Image 2.1 / Turbo, MOSS-Image, Krea 2 Raw / Turbo, FLUX.3 [klein], SDXL & finetunes, Anima | [Qwen-Image 2.1](https://huggingface.co/StillDeadcode/radiance-qwen-image-2.1-iq8r) · [Turbo](https://huggingface.co/StillDeadcode/radiance-qwen-image-2.1-turbo-iq8r) · [Krea 2 Turbo](https://huggingface.co/StillDeadcode/krea-2-turbo-radiance-iq8r) · [FLUX.3](https://huggingface.co/StillDeadcode/radiance-flux-3-klein-iq8r) |
| **Video** (`/v1/videos`) | MiniMax-H3 / FastH3 (stereo audio), LTX-2.5 (stereo audio), Wan 2.2 TI2V-5B | [MiniMax-H3](https://huggingface.co/StillDeadcode/minimax-h3-i8) · [FastH3](https://huggingface.co/StillDeadcode/fasth3-8-step-v2-i8) · [LTX-2.5 Distilled](https://huggingface.co/StillDeadcode/radiance-ltx-2.5-distilled-iq8r) |
| **Speech & Music** (`/v1/audio/speech`) | Breeze-TTS-2 (streaming + WS), Fish Audio drama-3, MiniMax-Music3 (44.1 kHz stereo) | [Breeze-TTS-2](https://huggingface.co/StillDeadcode/radiance-breeze-tts2-bf16) · [Music3](https://huggingface.co/StillDeadcode/minimax-music3-bf16) · `data/recipes/drama3-i8.recipe` |
| **3D Shape** (`/generate`) | Hunyuan3D-2 | `rad-convert` |
### Embeddings, Rerankers & Speech Recognition
| Task | Models | Source |
|---|---|---|
| **Embeddings** (`/v1/embeddings`) | EmbeddingGemma 2 (text/image/video/audio), Qwen3-Embedding (0.6B/4B/8B), Nemotron-3.5-Embed (1B/8B), nomic-embed-text-v2-moe | Serve HF checkpoints directly or `rad-convert` |
| **Rerankers** (`/v1/rerank`) | Qwen3-Reranker (0.6B/4B/8B), Nemotron-3.5-Rerank 8B | Serve HF checkpoints directly |
| **ASR** (`/v1/audio/transcriptions`, `/v1/realtime`) | Qwen3-ASR 1.7B (30 languages, live WebSocket) | [Qwen/Qwen3-ASR-1.7B-hf](https://huggingface.co/Qwen/Qwen3-ASR-1.7B-hf) |
> **Format note:** Legacy block-FP8, MXFP4 trunk, M2XFP4 and ParoQuant containers from 1.x are refused at startup; use BF16, IQ8R, IQR-V4, EXL3-V3 or GGUF containers instead.
---
## Convert a Checkpoint
`rad-convert` packs a Hugging Face or GGUF checkpoint into a `.rad` container using recipes from `data/recipes/` (use `scripts/hfget.sh <org/repo> <dir>` to download):
```sh
# Pack as-is (BF16)
build/bin/rad-convert /srv/models/hf/XHToken-Spark-X2.6-4B -o spark-x2.6-4b-bf16.rad --max-ctx 4096
build/bin/rad-convert /srv/models/hf/Qwen/Qwen3.8-27B -o qwen3.8-27b-bf16.rad \
--recipe data/recipes/q38-27b-bf16.recipe
build/bin/rad-convert /srv/models/hf/Qwen/Qwen3.8-Flash-Next -o qwen3.8-flash-next-bf16.rad --max-ctx 4096
build/bin/rad-convert /srv/models/hf/google/gemma-4-31B-it -o gemma4-31b-w4a8.rad \
--recipe data/recipes/gemma4-31b-dense-bf16-w4a8.recipe \
--set quantization_config.quant_method=compressed-tensors \
--draft-model /srv/models/hf/google/gemma-4-31B-it-assistant
build/bin/rad-convert /srv/models/hf/google/gemma-4-31B-it -o gemma4-31b-dense-w4a8-df.rad \
--recipe data/recipes/gemma4-31b-dense-bf16-w4a8-df.recipe \
--set quantization_config.quant_method=compressed-tensors \
--draft-model /srv/models/hf/z-lab/gemma-4-31B-it-DFlash
build/bin/rad-convert /srv/models/hf/google/gemma-4-31B-it -o gemma4-31b-dense-q8-df.rad \
--recipe data/recipes/gemma4-31b-dense-bf16-q8-df.recipe \
--set quantization_config.quant_method=compressed-tensors \
--draft-model /srv/models/hf/z-lab/gemma-4-31B-it-DFlash
# Meta's Muse Glimmer 30B, as it ships (bf16), with an int4 trunk and int8 attention values, or
# with an IQ8R trunk and an int8 head
build/bin/rad-convert /srv/models/hf/meta-models/Muse-Glimmer-30B -o muse-glimmer-30b-bf16.rad \
--recipe data/recipes/museglimmer-30b-bf16.recipe
build/bin/rad-convert /srv/models/hf/meta-models/Muse-Glimmer-30B -o muse-glimmer-30b-w4a8.rad \
--recipe data/recipes/museglimmer-30b-w4a8.recipe \
--set quantization_config.quant_method=compressed-tensors
build/bin/rad-convert /srv/models/hf/meta-models/Muse-Glimmer-30B -o muse-glimmer-30b-iq8r-dflash.rad \
--draft-model /srv/models/hf/meta-models/Muse-Glimmer-30B-assistant \
--recipe data/recipes/museglimmer-30b-iq8r.recipe \
--set quantization_config.quant_method=compressed-tensors
build/bin/rad-convert /srv/models/hf/ukisai/Swift-1.5-Qwen3.8-27b-W4A16-AWQ -o swift15-27b-w4a16.rad \
--recipe data/recipes/q38-27b-w4a16.recipe
# Any single-file SDXL checkpoint (SDXL 1.0, Illustrious, NoobAI, Pony, a civitai finetune), with
# CLIP's tokenizer.json from openai/clip-vit-large-patch14
build/bin/rad-convert /srv/models/hf/OnomaAIResearch/Illustrious-XL-v2.0/Illustrious-XL-v2.0.safetensors \
-o illustrious-xl-v2.0-bf16.rad --recipe data/recipes/sdxl-bf16.recipe \
--tokenizer /srv/models/hf/openai/clip-vit-large-patch14/tokenizer.json
# Quantise with a recipe and bundle a drafter
build/bin/rad-convert /srv/models/hf/google/gemma-4-31B-it -o gemma4-31b-q8-df.rad \
--recipe data/recipes/gemma4-31b-dense-bf16-q8-df.recipe \
--set quantization_config.quant_method=compressed-tensors \
--draft-model /srv/models/hf/z-lab/gemma-4-31B-it-DFlash
# Inside Docker (recipes live in /opt/radiance/share/radiance/recipes/)
docker run --rm -v /srv/models:/models --entrypoint rad-convert stilldeadcode/radiance ...
```
With Docker, use `docker run --rm -v /srv/models:/models --entrypoint rad-convert stilldeadcode/radiance ...`.
In the image the recipes are in `/opt/radiance/share/radiance/recipes/`. A checkpoint served at its
own precision needs no container: its directory is the entry's `model`
(`model: /srv/models/hf/Qwen/Qwen3.8-27B`). A release someone else quantised to an integer grid is
written at its own numbers where the kernels read them (an int4 W4A16 release, compressed-tensors'
AWQ and GPTQ or AutoRound's, on the 4-bit GEMMs with `data/recipes/q38-27b-w4a16.recipe`). Block
FP8, MXFP4, NVFP4 and ParoQuant releases are not served: convert the model's bf16 checkpoint with
an int8 recipe. [docs/GUIDE.md](docs/GUIDE.md) names the recipes of record
with their `rad-convert` commands.
See [`docs/TOOLS.md`](docs/TOOLS.md) for all `rad-convert`, `rad-sidecar`, `rad-info`, `rad-kbench` and `rad-tune` options.
Spark X2.6 runs BF16 at `tp: 1`, `2`, `3` or `4` -- and `8`, the worlds libr4d has an exact
all-reduce for -- without a drafter or quantisation recipe. Its checkpoint's chat template enables
thinking by default; replies return reasoning in `reasoning_content`. Set
`chat_template_kwargs.enable_thinking` to `false` for a non-thinking request. Tool calls use the
checkpoint's tagged format and are returned as OpenAI `tool_calls`.
---
## Test
```sh
ctest --test-dir build -L fast -j8 # the inner loop, under 15 s; build.sh runs it
ctest --test-dir build -LE 'gpu|oot' -j8 # everything that runs without a card (about 5 minutes)
ctest --test-dir build -L gpu # the card tests; they need the cards to themselves
ctest --test-dir build -L oot # rebuilds every bundled plugin out of tree against an install
ctest --preset fast # inner loop (<15 s); build.sh runs this
ctest --preset host # all CPU/host tests (~5 min)
ctest --preset gpu # GPU tests (require exclusive access to cards)
ctest --preset full # host + gpu + out-of-tree plugin rebuild (oot)
```
`CMakePresets.json` names the same runs (`ctest --preset fast`, `host`, `gpu`, `full`, `asan`), and
[`docs/GUIDE.md`](docs/GUIDE.md) §1.3 describes the tiers and the test binaries' options.
---
## Documentation
| | |
| Document | Contents |
|---|---|
| [`docs/GUIDE.md`](docs/GUIDE.md) | installing, converting, serving, the HTTP API, operating a server |
| [`docs/TOOLS.md`](docs/TOOLS.md) | every flag of every tool, and the recipe syntax |
| [`docs/DIAGNOSE.md`](docs/DIAGNOSE.md) | `diagnose`: the engine measures itself, and what makes a run a measurement |
| [`docs/DOCKER.md`](docs/DOCKER.md) | the image and the compose files |
| [`docs/PREPARING_YOUR_RIG.md`](docs/PREPARING_YOUR_RIG.md) | a two-R9700 machine from firmware setup to a serving model |
| [`docs/PLUGIN.md`](docs/PLUGIN.md) | writing a kernel library, architecture or quantiser plugin, including one for another AMD card |
| [`docs/ARCHITECTURES.md`](docs/ARCHITECTURES.md) | the supported model families and their geometry |
| [`docs/TP3.md`](docs/TP3.md) | any world size: the attention world and uneven delta-net heads; three ranks |
| [`docs/OPS.md`](docs/OPS.md), [`docs/KERNELS.md`](docs/KERNELS.md) | the op vocabulary, and what `rad-kbench` last measured |
| [`spec.md`](spec.md) | the design |
| [`docs/GUIDE.md`](docs/GUIDE.md) | Configuration keys, memory/TP/context/speculation tuning, HTTP & WS API reference, operations |
| [`docs/MULTIMODEL.md`](docs/MULTIMODEL.md) | Multi-model fleet serving, parking/eviction, pools, hot reload |
| [`docs/DOCKER.md`](docs/DOCKER.md) | Docker image, compose files, `docker run` flags, custom builds |
| [`docs/PREPARING_YOUR_RIG.md`](docs/PREPARING_YOUR_RIG.md) | Bare-metal setup guide for a multi-GPU AMD Linux host |
| [`docs/TOOLS.md`](docs/TOOLS.md) | CLI tools (`rad-convert`, `rad-info`, `rad-kbench`, `rad-tune`, `rad-sidecar`, `rad-yaml`, etc.) and recipe syntax |
| [`docs/ARCHITECTURES.md`](docs/ARCHITECTURES.md) | Supported model plugins, geometry and per-family notes |
| [`docs/PLUGIN.md`](docs/PLUGIN.md) | Writing kernel, architecture and quantiser `.so` plugins (ABI 46) |
| [`docs/IMPLEMENTATION.md`](docs/IMPLEMENTATION.md) | Contributor guide, layout and build conventions |
| [`docs/OPS.md`](docs/OPS.md) | Machine-checked op schema contract between arch plugins and kernel libraries |
| [`docs/KERNELS.md`](docs/KERNELS.md) | Kernel libraries and running `rad-kbench` verification/benchmarks |
| [`docs/DIAGNOSE.md`](docs/DIAGNOSE.md) | Built-in `diagnose` self-measurement mode |
| [`docs/IQR.md`](docs/IQR.md), [`docs/MOE-W4.md`](docs/MOE-W4.md) | Low-bit quantisation formats (IQR-V1..V4, W4/W5/W6 MoE experts) |
| [`docs/KV-STREAMING.md`](docs/KV-STREAMING.md), [`docs/QSA.md`](docs/QSA.md), [`docs/YARN.md`](docs/YARN.md) | Long-context subsystems (host-streamed KV, QSA, YaRN) |
| [`docs/TP3.md`](docs/TP3.md), [`docs/LORA-ROTATED.md`](docs/LORA-ROTATED.md) | Arbitrary-world-size tensor parallelism (TP3/TP4) and rotated-trunk LoRA |
| [`spec.md`](spec.md) | Engine architecture specification |
---
## License
[Apache-2.0](LICENSE), copyright Deadcode and the radiance contributors. Keep [`NOTICE`](NOTICE)
with any copy or derivative. It credits the authors and lists the MIT-licensed code the tree
includes. The model weights are not covered: each keeps the license of the model it was converted
from. The Docker image also holds third-party libraries under their own licenses, GPL and LGPL
among them; `/usr/share/doc/THIRD-PARTY` in the image lists each one with its version and source.
[Apache-2.0](LICENSE), copyright Deadcode and the radiance contributors. Keep [`NOTICE`](NOTICE) with any copy or derivative. Model weights retain their respective upstream licenses. The Docker image includes third-party libraries under their own licenses (listed in `/usr/share/doc/THIRD-PARTY` inside the image).
+26 -2
View File
@@ -17,6 +17,7 @@
#include "device/device.h"
#include "format/radfile.h"
#include "gen_config.h"
#include "kvstream/bringup.h"
#include "kvstream/stage.h"
#include "sample/accept.h"
#include "sched/scheduler.h"
@@ -872,10 +873,33 @@ int Engine::page_back_in(int64_t* left) {
return frc;
}
if (irc < 0) return irc;
if (erc < 0)
if (erc < 0) {
device_set_error("the KV cache and expert ranges could not be backed again: %s",
elastic_why.c_str());
return erc;
return erc;
}
/* The elastic KV pool was discarded on park and re-backed with fresh, uninitialised pages.
* Re-initialise the kvstream residency maps and control counters carved out of it on every
* rank (as configure_kv does at bring-up) and reset stream_prev_ so cumulative counter deltas
* start from zero again. */
const int prev_dev = dev_current();
for (auto& r : ranks_) {
if (r->kv.stream_cost().groups <= 0) continue;
if (rad_dev_set(r->device) < 0) {
(void)rad_dev_set(prev_dev);
device_set_error("selecting rank %d device for kvstream restore failed", r->index);
return RAD_E_DEVICE;
}
if (const int krc = kvstream_fill(r->kv); krc < 0) {
(void)rad_dev_set(prev_dev);
device_set_error("kvstream maps on rank %d could not be re-initialised after restore: %s",
r->index, rad_strerror(krc));
return krc;
}
}
(void)rad_dev_set(prev_dev);
stream_prev_.clear();
return RAD_OK;
}
int Engine::unpark_live(std::string* why, int64_t* left) {
+68 -3706
View File
File diff suppressed because it is too large. Load diff
+4 -4
View File
@@ -84,7 +84,7 @@ reported beside the token comparison, since it is not a correctness difference.
4. A correctness window: repeat and oracle for chosen ops over a step window rather than the whole
process, with ops that have no `libref` line reported as NOT CHECKED.
Steps 1b to 4 are listed under `not_measured` in every report, so a number that is absent says so
in the artifact itself and never reads as a zero. The mode is host-buildable and its arithmetic is
tested on the host; the numbers it writes on a card are the measurement, and belong with the
hardware they came from.
Steps 1b, 3 and 4 (plus HTTP/client overhead) are listed under `not_measured` in every report, so
a number that is absent says so in the artifact itself and never reads as a zero. The mode is
host-buildable and its arithmetic is tested on the host; the numbers it writes on a card are the
measurement, and belong with the hardware they came from.
+7 -7
View File
@@ -43,7 +43,7 @@ The `Dockerfile` stages:
| stage | what it does |
|---|---|
| `ffmpeg` | FFmpeg 8.1 with only the demuxers `core/mm/media.cpp` admits, the decoders their streams carry (still images, H.264, HEVC, VP8, VP9, AV1 through dav1d, MPEG-1/2/4, Theora, FLV/H.263, and audio) and the three encoders the images API writes (PNG, JPEG, WebP). The distribution's build brings about 200 packages the engine never uses |
| `ffmpeg` | FFmpeg 8.1.3 with only the demuxers `core/mm/media.cpp` admits, the decoders their streams carry (still images, H.264, HEVC, VP8, VP9, AV1 through dav1d, MPEG-1/2/4, Theora, FLV/H.263, and audio) and the three encoders the images API writes (PNG, JPEG, WebP). The distribution's build brings about 200 packages the engine never uses |
| `llvm` | ROCm's `libLLVM` rebuilt from ROCm's llvm-project at the commit the image's `clang --version` names, configured as ROCm ships it, with `docker/llvm-vopd-pairing.patch` applied. ROCm 10.1's clang does not compile the same source to the same code twice (its VOPD pairing follows heap addresses); the patch makes it repeatable. This library is the only compiler file that changes |
| `build` | `rocm/dev-ubuntu-24.04:10.1.0-full` plus cmake, ninja and g++-14. Device code is compiled by ROCm's clang from `/opt/rocm-repeatable`, a shadow of the ROCm tree whose `libLLVM` is the `llvm` stage's (`-DRAD_HIP_VOPD_REPEATABLE=ON`, `--rocm-path=/opt/rocm`); the HIP runtime and comgr in the image are ROCm's own. Configures with kernels for `GPU_TARGETS`, builds, and installs to `/opt/radiance` with the recipes. Device code is not stored compressed: the engine's AQL backend reads the fat binaries itself and refuses a compressed bundle |
| `test` | `docker/llvm-check.sh`, then `ctest -LE 'gpu\|oot'`: every suite that runs without a card. The check recompiles one kernel file four ways: with pairing off, the image's compiler must emit ROCm's device code byte for byte; with pairing on, two compiles must match the build's own object. The image is produced only if both pass |
@@ -75,7 +75,7 @@ docker run --rm --device /dev/kfd --device /dev/dri --security-opt seccomp=uncon
## Run it
The entrypoint is `radiance`, which reads its settings from a YAML file named by `--config`
([`docs/GUIDE.md`](GUIDE.md) §4, [`docs/MULTIMODEL.md`](MULTIMODEL.md) §4). The other installed tools (`rad-convert`, `rad-info`, `rad-kbench`,
([`docs/GUIDE.md`](GUIDE.md), [`docs/MULTIMODEL.md`](MULTIMODEL.md)). The other installed tools (`rad-convert`, `rad-sidecar`, `rad-info`, `rad-kbench`,
`rad-tune`, `rad-schemas`, `rad-tokcheck`, `rad-yaml`, and `rad-export`, which runs on the host
since the image has no Python) are on `PATH`, and the recipes are in
`/opt/radiance/share/radiance/recipes/`.
@@ -136,14 +136,14 @@ docker run ... -v /srv/radiance-plugins:/plugins:ro \
`/plugins` holds any of `kernels/`, `architectures/` and `quantizers/`, built against the same
radiance version (`docs/PLUGIN.md` §13). The engine in the image starts on any AMD GPU family: the
image's `GPU_TARGETS` are what its bundled kernel library, libr4d, is compiled for, not a limit on
the cards the engine runs on.
image's `GPU_TARGETS` are what its bundled kernel libraries (`libr4d`, `libhalo`, `libr3d`, `exl3i`)
are compiled for, not a limit on the cards the engine runs on.
## Compose
`deploy/compose/` has two compose files, `tp1.yaml` for one card (`RADIANCE_GPU` names
it) and `tp2.yaml` for two, each with the server's configuration in a file beside it
(`tp1.radiance.yaml`, `tp2.radiance.yaml`). Each runs one container that serves eleven models behind one port and
`deploy/compose/` has three compose files — `tp1.yaml` for one card (`RADIANCE_GPU` names it),
`tp2.yaml` for two, and `tp4.yaml` for four — each paired with a `.radiance.yaml` file beside it
(and a tailored `seccomp-radiance.json` profile). Each runs one container behind one port and
brings a model onto the cards when a request names it, parking or unloading others to make room
([`docs/MULTIMODEL.md`](MULTIMODEL.md));
[`deploy/compose/README.md`](../deploy/compose/README.md) lists the models of each.
-186
View File
@@ -1,186 +0,0 @@
# Flint on radiance
Recursive Flint (39.8B total / ~2.5B active): a 49-layer decoder with 2 dense layers followed by
47 sigmoid-routed MoE layers. The architecture plugin is `arch/flint`; the containers are built
from the BF16 checkpoint with `rad-convert`.
## Status
- **Q4** (`flint-q4.rad`, 19.72 GiB, fits one card): u4 attention, int4 experts, plain int8
dense/shared/head. Served on this build by the same forms as `hyv3_bf16`'s W4 and W8 recipes.
- **IQ8R** (`flint-iq8r.rad`, about 38 GiB, two cards): an IQ8R trunk and rotated int8 experts,
the forms `qwen35moe_w8a8` serves Qwen3.6-35B-A3B with. It replaces the plain int8 "Q8"
container of the 1.17-era port, whose unrotated int8 experts this build does not serve (a
container converted that way is refused by name; convert it again with the IQ8R recipe).
The measurements below were taken on the 1.17-era build with the forms it used then (the plain
int8 Q8 container and that build's plain int8 grouped GEMM); they have not been repeated on this
build. See [Measured](#measured).
## Geometry
| | |
|---|---|
| layers | 49: 2 dense, 47 MoE |
| attention | 32 query / 4 KV heads, head_dim 128, QK RMSNorm per head |
| sink | learned per-head `softmax_offset` on every layer (`attn_paged_sink`) |
| position | RoPE on the 35 sliding layers; NoPE on the 14 full layers |
| window | 513 on the sliding layers |
| FFN | dense `n_ff` 6144; MoE 256 experts, top-6, expert width 512, shared 1024, sigmoid routing, `norm_topk_prob` |
| vocab | 150144, untied head |
| KV | two groups: full (14 layers) and window 513 (35 layers) |
The full layers are `0, 1, 5, 9, ..., 45, 48`; the rest are sliding and carry RoPE.
## Containers and recipes
| file | contents | size |
|---|---|---|
| `flint-q4.rad` | U4 attention, I4 experts, INT8 dense/shared/head, BF16 router/norms/embed | 19.72 GiB |
| `flint-iq8r.rad` | IQ8R attention/dense/shared gate-up, rotated INT8 experts and shared down, INT8 head, BF16 router/norms/sinks/embed | about 38 GiB (not re-measured) |
Recipes: `data/recipes/flint-bf16-q4.recipe` and `data/recipes/flint-iq8r.recipe`.
The plugin reads which form a container holds from layer 0's q projection:
- **Rotated int8 trunk** (IQ8R, or the 128-group rotated int8 form): the norms write
`rmsnorm_had_quant_i8g`'s codes (`ar_rmsnorm_had_quant_i8g` with the fused all-reduce at TP2),
the attention output `had_quant_act_i8g`'s and the gated products `gated_had_quant_i8g`'s, and
every linear reads them at `i8a8h` without a quantiser of its own. The routed experts must be
stored rotated (int8, or a rotated four-bit form with an int8 row); the grouped GEMM
(`moe_gemm_i8a8`) reads the block input's own codes for gate/up and the gated product's, at one
scale a 128, for down.
- **Any other trunk** (bf16, the Q4 recipe's u4 attention, plain int8 linears): each linear reads
the bf16 plane or quantises it itself (`quant_act_i8g` for a plain int8 weight), and four-bit
experts read the block input's E4M3 pair (`moe_gemm_w4a8`).
A rotated trunk over unrotated experts, or rotated int8 experts under an unrotated trunk, is
refused at declare with the recipe to use.
Two non-obvious inputs:
- `data/flint-zero-bias.safetensors`: Flint has no router correction bias. The sigmoid router's
bias is selection-only, so the converter merges 47 x `[256]` zero tensors under
`model.layers.N.mlp.expert_bias`.
- `data/flint-chat-template.jinja`: the checkpoint's template contains `\x00`, which the Jinja
parser rejects. This is the same template without that replace; pass it with `--chat-template`,
or `/v1/chat/completions` answers 501 for want of a template.
## Convert
```bash
export RADIANCE_HOME=$PWD/build/radiance_home
# Q4
./build/bin/rad-convert "$HOME/models/flint" \
--add data/flint-zero-bias.safetensors \
--recipe data/recipes/flint-bf16-q4.recipe \
--chat-template data/flint-chat-template.jinja \
--report 20 --gpus 0,1 -o "$HOME/models/rad/flint-q4.rad"
# IQ8R
./build/bin/rad-convert "$HOME/models/flint" \
--add data/flint-zero-bias.safetensors \
--recipe data/recipes/flint-iq8r.recipe \
--chat-template data/flint-chat-template.jinja \
--report 20 --gpus 0,1 -o "$HOME/models/rad/flint-iq8r.rad"
```
`--plan-only` is the cheap pre-flight: it runs declare and resolves every op against the loaded
kernels before reading the 75 GiB checkpoint.
## Serve
```bash
# Q4, one card
./build/bin/radiance --model "$HOME/models/rad/flint-q4.rad" \
--radiance-home build/radiance_home --max-model-len 262144 --port 8090
# Q4, two cards (long context, expert parallel)
./build/bin/radiance --model "$HOME/models/rad/flint-q4.rad" --tp 2 \
--radiance-home build/radiance_home --max-model-len 262144 --port 8090
# Q4 with the int8 KV cache (about half the cache memory)
./build/bin/radiance --model "$HOME/models/rad/flint-q4.rad" \
--radiance-home build/radiance_home --max-model-len 262144 \
--kv-cache-dtype i8 --port 8090
# IQ8R needs both cards: about 38 GiB of weights
./build/bin/radiance --model "$HOME/models/rad/flint-iq8r.rad" --tp 2 \
--radiance-home build/radiance_home --max-model-len 131072 --port 8090
```
The KV cache is bf16 by default, or with `--kv-cache-dtype i8` the int8 cache: K and V as int8
codes with one f16 scale each per token and head (`2 * head_dim + 4` bytes a token and head).
Both KV groups, the full one and the 513-token window, take it, and the sink attention, the store
and the fused prologue all have rows for both. No other cache dtype is served.
## Measured
Taken on the 1.17-era build, before this port: the "Q8" columns are the plain int8 container
(unrotated int8 linears and experts, served by that build's plain int8 grouped GEMM), which this
build no longer serves; the IQ8R container has not been measured. The Q4 container is the same
recipe, served now by this build's kernels, and has not been re-measured either.
Two R9700s, greedy, warm, prefix cache disabled. Q4 and Q8 both at TP2. The payloads are
1,325 / 8,928 / 26,073 tokens. Tokenizers differ at 26K, so the payload is not the same token
count on both sides.
| context | Q4 prefill | Q4 decode | Q8 prefill | Q8 decode |
|---|---|---|---|---|
| 1.3K | 14,488 | 161.4 | 8,036 | 112.5 |
| 9K | 14,019 | 154.5 | 8,232 | 109.8 |
| 26K | 11,850 | 136.6 | 7,621 | 100.4 |
Reference on the same box, llama-server Q8 (fresh server, `-ngl 999 --jinja`) and Q4 (the
release's GGUF): about 2,364 / 5,359 / ~5,028 tok/s prefill for Q8 at 1.3K / 9K / 26K, ~65-70
tok/s decode, and 2,197 / 5,400 / ~3,290 tok/s prefill for Q4 with 77.7 tok/s decode at 1.3K.
llama.cpp's numbers move with its build and flags; re-measure beside the run being reported.
## Kernels
- **Experts.** IQ8R: `moe_gemm_q` at dtype `i8a8h` (`moe_gemm_i8a8`), rotated int8 weights at a
bf16 scale a (row, 128 of K) against the rotated int8 activation. Q4: `moe_gemm_q` at `w4a8`
(`moe_gemm_w4a8`) against the E4M3 activation. Expert parallel at TP2: each rank holds 128
whole experts a layer. On the 1.17-era build the Q4 w4a8 oracle reported the rows past
`off[n_expert]` as a mismatch (the kernel zeros the dropped tail, the reference computes it);
every live row agreed, and the first bad offset was `live * N`.
- **Sink attention.** `attn_paged_sink` at head_dim 128, gqa 8, on the bf16 or the int8 cache.
A prefill-shaped launch takes the WMMA kernel with the sink folded in: the sink seeds the running
max and one lane's denominator in the log2 domain, and the final reduction adds both lanes.
Decode and verify launches take the scalar kernel with split-KV, whose unsplit store and merge
fold the sink.
- **Residual and all-reduce.** `NormQuant` folds the previous block's delta and its two-rank
all-reduce into the norm (`fuse_ar`), so only the embedding's reduce and the last block's
remain. Flint also sets `shared_fp32_combine` 0: the gather adds the local routed and shared
partials and one collective covers both, which is the TP1 arithmetic. The exact cross-rank
wire is the default; under `--tp-wire wht6` both trunk forms' norms have a 6-bit fused form
(`ar_rmsnorm_had_quant_i8g` and `ar_rmsnorm_quant_fp8` at `wire` 6).
- **NoPE prologue.** At decode heights the 14 full layers use `qkv_norm_rope_kv_store` with
`rotary_dim` 0: the kernel copies the normed head through the rotary stage, so it is the norms
and the store alone. Prefill heights take the standalone norms and `kv_store`, without a
rope on those layers.
## Correctness
On the 1.17-era build (not repeated on this one):
- Needle retrieval at 8K and 32K returned `ZX-417-QQ` exactly, with BF16 and E4M3 KV, including
after the sink-aware WMMA prefill.
- A `get_weather` tool call parsed as `tool_calls` with `{"city":"Paris"}`; reasoning uses
`<think>...</think>`.
- A 250,696-token prompt completed on two cards. On one card, Q4 at 262K fit with that build's
E4M3 KV cache: 19.37 GiB of weights plus an 11.45 GiB cache. The int8 cache of this build takes
a few percent more a token (its two f16 scales a token and head).
On this build, `tests/flint_arch_test.cpp` checks the declared graph and the step of both
containers at one and two ranks on both caches, and `tests/r4d_emu/test_attn.cpp` the sink WMMA
prefill on the bf16 and the int8 cache.
## Known limitations
- **Decode attention.** The scalar sink kernel is the short-context ceiling: ~184 us for a
513-window layer at 1.3K, against ~15 us of KV traffic. A flash-decoding decode form is the
follow-up.
- **No draft head.** Flint has no MTP head. Prompt-lookup speculation is available at serve time
and is workload-dependent.
+169 -5145
View File
File diff suppressed because it is too large. Load diff
+6 -5
View File
@@ -53,9 +53,10 @@ plugin/exl3quant/ the `exl3i` quantiser: imports EXL3-V3 levels into the exl3i e
plugin/qwen35_exl3/, plugin/gemma4_exl3/
the architectures (`qwen35`, `exl3`) and (`gemma4`, `exl3`) over those linears
plugin/exl3import/ the EXL3-V3 decode (the oracle) and interface headers the four share
plugin/lora_plain/ optional host kernel plugin decoding rotated int8 weights for runtime LoRA
arch/<id>/ one architecture plugin per directory
tools/ rad-info, rad-convert, rad-export, rad-kbench, rad-tune, rad-schemas,
rad-tokcheck, rad-yaml, rad-chatparse, rad-gbnf-check
tools/ rad-info, rad-convert, rad-sidecar, rad-export, rad-kbench, rad-tune,
rad-schemas, rad-tokcheck, rad-yaml, rad-chatparse, rad-gbnf-check
cmake/ rad_add_plugin, and the package config an out-of-tree plugin find_package()s
scripts/ harnesses for serving, tracing and profiling a running engine
dashboard/ the page the engine serves at `/` (React, built by Vite into
@@ -66,9 +67,9 @@ integrations/ clients of the HTTP API (ComfyUI nodes)
data/ kernels.rkb and kernels_moe.rkb: recorded references rad-kbench replays with
no model. Two, because no one container declares the whole vocabulary.
recipes/: the quantisation recipes of the containers this tree serves
docs/KERNELS.md what rad-kbench last measured, generated and checked in
vendor/ llama.cpp lifts tracked to an upstream commit (vendor/UPSTREAM), changed only
through vendor/patches/; yyjson and cpp-httplib
docs/KERNELS.md shipped kernel libraries and how to run rad-kbench verification/benchmarks
vendor/ llama.cpp and cpp-httplib lifts tracked in vendor/UPSTREAM (chat/jinja
maintained in place; remaining diffs in vendor/patches/)
tests/ ctest
```
+6 -6
View File
@@ -273,12 +273,12 @@ for the target recipe. To retain an existing calibrated target, pass `--reuse or
the **same source, target recipe and calibration** and write a new file. Check the converter's
reuse count and that the plan includes `mtp.fc.weight`, `blk.64.*` and `mtp.draft_head.weight`.
To fit the U2 draft head to its actual inputs, run with `--calib-corpus FILE`, `--calib-dir DIR`,
`--calib-layers 64:65` and `--num-speculative-tokens 0`. Layer 64 is the MTP block beside a
64-layer trunk; this records `gram.r0.mtp.draft_head.bin` without loading the draft projection or
generating proposals. Use `--calib-corpus`, not `--kld-record`, and select the virtual layer alone:
this skips the trunk's separate int8 Hessian capture and allows tensor parallelism. Leave draft
coupling off. Use `q38-27b-native-mtp-u2-gptq.recipe` in place of the RTN overlay, set
To fit the U2 draft head to its actual inputs, configure the model entry in `radiance.yaml` with
`calib-corpus: FILE`, `calib-dir: DIR`, `calib-layers: "64:65"` and `num-speculative-tokens: 0`.
Layer 64 is the MTP block beside a 64-layer trunk; this records `gram.r0.mtp.draft_head.bin`
without loading the draft projection or generating proposals. Use `calib-corpus` (not `kld-record`)
and select the virtual layer alone to skip trunk int8 Hessian capture and allow tensor parallelism.
Leave draft coupling off. Use `q38-27b-native-mtp-u2-gptq.recipe` in place of the RTN overlay, set
`MTP_CALIB=DIR` and keep `CALIB` pointed at the target recipe's original Hessians. The base
IQ4R-S-V4 recipe stays unchanged. The serving plugin is `qwen35_w8a8` (rotated int8 activations),
not the deprecated block-FP8 plugin.
+32 -11382
View File
File diff suppressed because it is too large. Load diff
-47
View File
@@ -1,47 +0,0 @@
# Krea 2 instruction editing
An edit-enabled Krea Raw container supports text-to-image and instruction editing under one model ID. Convert the full Diffusers pipeline, including the Qwen3-VL vision tower and VAE encoder, with matching executable and plugins:
```sh
rad-convert /models/Krea-2-Raw -o /models/krea-2-raw-edit-iq8r.rad \
--set pipeline.krea_reference_encoder=1 --recipe data/recipes/krea-2-iq8r.recipe
```
Set `image-gen-max-refs: 2` to budget for two reference images. This setting reserves memory, so leave it at one when a second reference is unnecessary.
Memory: an edit container keeps its conditioning store resident for the whole run, even for plain text-to-image requests. It holds `2 branches x lanes x store_rows x 6144 x 2 B` per rank, where `lanes` is the configured `max-seqs` (at most 8) and `store_rows = 1024 + 576 per extra reference + max_refs x max_image_tokens` (a text-only container uses 512 rows). Image tokens are `gen_max_pixels / 256`. At the full 8 lanes, with the default DiT width of 6144:
| profile | store rows | store size (8 lanes) |
|---|---|---|
| text-only container | 512 | about 96 MiB |
| edit container, 1 reference, 1 MP | 5120 | about 0.94 GiB |
| edit container, 1 reference, 4 MP | 17408 | about 3.2 GiB |
| edit container, 2 references, 4 MP | 34368 | about 6.3 GiB |
Fewer lanes scale the store down proportionally (`max-seqs: 2` is a quarter of these figures). The transient fusion rows also grow from 512 x 12 to 1024..1600 x 12 on an edit container. Lower `gen_max_pixels`, `image-gen-max-refs` or `max-seqs` on smaller cards. The primary text model and image generator can be separate entries in a Radiance fleet.
Send `POST /v1/images/edits` with the image model ID, instruction, size, and one or two ordered references. The JSON form uses `images` as an array of image URLs or data URLs. For multipart requests, use repeated `image` fields. A one-reference request remains valid when the model allows two. Text-only generation continues through `/v1/images/generations`.
```json
{"model":"krea-edit","prompt":"Change the mug to blue, preserving the rest of the scene.","images":["data:image/png;base64,..."],"size":"1024x1024","seed":42,"num_inference_steps":20}
```
Krea fits and centers each reference independently. Use references of the dimensions recommended by your adapter. Identity fidelity with specific adapters requires separate qualification. A two-reference edit should describe each reference's role explicitly. Pose-only transfer with identity preservation remains unqualified.
The optional `ref_boost` multiplies the attention weight of reference tokens. Its default of 1 leaves reference attention unchanged. Masks are rejected for this instruction-edit path. LoRAs use the existing per-request `loras` field. Stacking adapters may require increasing `max-lora-rank` beyond its default.
A seeded result is reproducible only with the same model, adapters, settings, and runtime profile. The same numeric seed in ComfyUI and Radiance can initialize different noise.
## Registered outfill
Use the Registered Outpaint adapter with one reference, an explicit `size: "1024x1024"`, and a scene description. Add `"outfill": {"horizontal": "center", "vertical": "center"}` to the edit request. The source's long edge scales to 1024. Horizontal placement accepts left, center, or right, and vertical placement accepts top, center, or bottom. Defaults are top left. After decoding, the source is blended back over a 32-pixel seam, but only on sides that border generated area: a side on the canvas boundary keeps the source pixels unchanged.
The profile uses the simple Euler schedule with eight steps by default. `guidance_scale: 0` corresponds to ComfyUI CFG 1 for Krea. Masks, multiple references, and `ref_boost` are rejected for this path.
```sh
python3 scripts/krea2_outfill.py input.png output.png \
--url http://127.0.0.1:8000/v1 --model krea-edit \
--prompt "A person standing in a sunlit studio"
```
The script defaults to `http://127.0.0.1:8000/v1` and model `krea-edit` and applies no adapters. Name each adapter you want with `--lora NAME[:WEIGHT]` (repeatable); the Registered Outpaint adapter's name is whatever your deployment calls it.
+14 -5
View File
@@ -9,9 +9,9 @@ fits VRAM plus a few GiB of pinned host.
## What is served
Qwen3.8-Flash-Next is served as `w4nl64-i8lm.rad`, built by
`data/recipes/qwen4exp-w4nl64-i8-hc8m.recipe` with `CALIB=<dir>` naming the calibration Grams (see
"Calibration"):
The `w4nl64-i8lm.rad` profile (built by `data/recipes/qwen4exp-w4nl64-i8-hc8m.recipe` with
`CALIB=<dir>` naming the calibration Grams; see "Calibration"; superseded for the default release
by IQR-V4 in [`docs/IQR.md`](IQR.md)) serves:
- routed experts at `w4nl64a8h`: the w4nl codebook, an E4M3 scale per row and group of 64, GPTQ
and three sweeps of coordinate descent;
@@ -92,7 +92,7 @@ The encodings are **not interchangeable**:
| `affine:codes=u4[1x1],scale=fp8_e4m3[1x64],scale.1=f32[*x*],table=f32{1x16}/fwht128` | `w4nl64a8h` | the codebook with an E4M3 scale per row and group of **64**, under one fixed f32 (below); the same bytes |
| `affine:codes=u4[1x1],scale=fp8_e4m3[1x32],scale.1=f32[*x*],table=f32{1x16}/fwht128` | `w4nl32a8h` | the same at a group of **32**, +0.125 bits per weight |
| `affine:codes=u5[1x1],scale=fp8_e4m3[1x64],scale.1=f32[*x*],table=f32{1x32}/fwht128` | `w5nl64a8h` | `w4nl64a8h` with **five-bit** codes into the 32-level `w5nl` codebook (below), +1 bit per weight |
| `affine:codes=u6[1x1],scale=fp8_e4m3[1x64],scale.1=f32[*x*],table=f32{1x64}/fwht128` | `w6nl64a8h` | `w4nl64a8h` with **six-bit** codes into the 64-level `w6nl` codebook ([MOE-W6.md](MOE-W6.md)), +2 bits per weight |
| `affine:codes=u6[1x1],scale=fp8_e4m3[1x64],scale.1=f32[*x*],table=f32{1x64}/fwht128` | `w6nl64a8h` | `w4nl64a8h` with **six-bit** codes into the 64-level `w6nl` codebook ([below](#six-bit-candidate-w6nl64a8h)), +2 bits per weight |
The first two differ only in the transform. The plugin reads the first expert's encoding
(`rad_weight_encoding`) and declares the matching kernels; a kernel that does not read an encoding
@@ -390,7 +390,16 @@ mistyped directory is a message, not a silent quality loss.
single-call oracle.
**End-to-end quality against the bf16 model** is the engine's KL mode
([TOOLS.md](TOOLS.md#the-kl-mode)): the full-vocabulary KL at every position of a fixed corpus, its
([`docs/TOOLS.md`](TOOLS.md)): the full-vocabulary KL at every position of a fixed corpus, its
mean and tail percentiles, and the top-1 agreement. It needs the **full 48-layer container**: the
4-layer bring-up slice cannot resolve a difference this small (its residual probe reads the same to
within 1% for fp8, `w4a8`, `w4a8h` and GPTQ alike).
## Six-bit candidate: `w6nl64a8h`
`w6nl64a8h` extends the scalar codebook to 6 bits (64 E4M3-exact symmetric entries, bit 5 = sign,
bits 0–4 = magnitude, `fp8_e4m3` scales per group of 64 under fixed upper scale `2^-13`, `fwht128`
transform) for routed experts' down projection (`data/recipes/qwen4exp-u4-w6nl-bf16ple.recipe`,
fitted via `tools/fit_w6nl.py`). Codes are packed LSB-first (`6*K/8` bytes/row) and rearranged by
`libr4d` into permuted low nibbles plus two bit planes. Synthetic kernel timing is available via
`r4d_selftest libr4d.so --perfw6nl M [iters] [experts] [top_k]`.
-29
View File
@@ -1,29 +0,0 @@
# W6NL routed experts: candidate implementation
`w6nl64a8h` is a six-bit scalar codebook for the routed experts' down projection. It is a candidate format, not a claim that six-bit down improves task quality. `data/recipes/qwen4exp-u4-w6nl-bf16ple.recipe` pairs it with U4 trellis gate/up and preserves the existing U5 trunk, protected BF16 experts, BF16 PLE/vision and draft recipe.
## Format
The canonical weight is an affine `u6` code plane with a 64-entry `f32` table, `fp8_e4m3` scales per row per 64 columns and one `f32` scale above them, with the `fwht128` transform. The first 32 table entries are positive E4M3-exact magnitudes and the second 32 their negatives. Bit 5 is sign; bits 0–4 select the magnitude. The fixed upper scale is `2^-13`; the quantizer folds the unnormalised Hadamard's `1/128` into the weight scale.
The container's six-bit codes are packed LSB-first. At load, `libr4d` arranges each row as the permuted low nibbles followed by two bit planes (the high magnitude bit and sign). Both arrangements occupy `6*K/8` code bytes per row. The kernel expands the two 16-entry halves of the magnitude table to E4M3, selects between them and merges sign before the existing FP8 WMMA. The loader checks the entire table, the fixed upper scale, transform and shape; same-width encodings with different semantics are refused.
A trellis gate reads rotated INT8 activations; W6NL down reads a separately quantized rotated E4M3 gated intermediate, like W5NL. The architecture must select that producer and the W6 kernel for the down projection. The BF16 protected experts retain their separate path.
## Codebook pilot
The candidate table is fitted, not derived from the evaluation prompts. `tools/fit_w6nl.py /path/to/original-bf16-checkpoint` reads only selected BF16 safetensor rows; it does not load or serve a model. It samples five experts per layer, 128 rows per expert, and FWHT-rotates weights in groups of 128 before normalising each group of 64 by its absolute maximum. Fit layers are 0, 8, 16, 24, 32, 40 and 47 (2,867,200 weights); separate check layers are 4, 12, 20, 28, 36 and 44 (2,457,600 weights). The script fits a 32-magnitude symmetric grid and chooses distinct E4M3-representable values.
On that separate weight sample, normalised scalar MSE with one globally optimized scale per table was approximately 0.000305 for W5NL and 0.000103 for this W6NL candidate. This is **not** a GPTQ, activation-weighted, KL or task result. It does not establish model quality or prove the candidate's table is optimal.
A separate 41,600-group sample had candidate pre-rounded group scales between 0.136 and 1.160 in E4M3 units under the fixed upper scale, with none subnormal or above the format's maximum. This does not cover every expert; check saturation and fallback reports during actual conversion.
## Checks and limits
The host tests cover W6NL GPTQ on a synthetic BF16-domain Gram, all 64 code values, exact table/scale checks, packing and reference math. The synthetic GPU tests exercise all 64 codes, sorted and token-order inputs, two/four classes and decode/prefill forms; they do not load a model. The U4/W5, U4/W6, U5/W5 and U5/W6 graph declarations are checked for both TP ranks.
A `rad-convert --plan-only` pass over the BF16 checkpoint declared 51,489 weights and estimated about 170.26 GiB for the candidate recipe. The plan used placeholder calibration paths and wrote no model: it validates neither the downloaded Grams nor conversion.
For a synthetic TP2-shaped down-projection latency comparison, run `r4d_selftest /path/to/libr4d.so --perfw6nl M [iters] [experts] [top_k]`. It compares W5NL and W6NL using the same routing and resident, synthetic weights, with automatic and pinned launch forms; byte-parity checks compare launch forms **within** each format, not W5 values to W6 values. Repeated synthetic kernel timing is not end-to-end model throughput.
These tests are not an end-to-end model validation. No full W6 model has been converted or scored; mixed-model inference, model throughput, placement, and speculative parity require separate validation. The main calibration directory must be reassembled and verified before conversion, with the separate draft Gram directory supplied as `MTP_CALIB`.
+79 -1012
View File
File diff suppressed because it is too large. Load diff
+41 -3723
View File
File diff suppressed because it is too large. Load diff
+4 -3
View File
@@ -8,9 +8,10 @@ links nothing of radiance's:
- a **quantiser** turns a checkpoint's weights into the planes of an encoding, for `rad-convert`.
A plugin is compiled against the installed `abi/` headers alone, so a third party can ship one
without building the engine. The in-tree plugins (libr4d, libref, libavx, libquant, every
architecture, and the plugins under `plugin/`: spechub, glm and the EXL3-V3 set exl3i, exl3quant,
qwen35_exl3 and gemma4_exl3) use the same interface: each is built with `rad_add_plugin`, builds on
without building the engine. The in-tree plugins (libr4d, libhalo, libr3d, libref, libavx,
libquant, every architecture, and the plugins under `plugin/`: spechub, glm, lora_plain, and the
EXL3-V3 set exl3i, exl3quant, qwen35_exl3 and gemma4_exl3) use the same interface: each is built
with `rad_add_plugin`, builds on
its own against an installed radiance, and is found and ranked by what it declares, never by its
name. `ctest -L oot` (`tests/oot_plugins.sh`) rebuilds them out of tree against an installed prefix
(the device libraries, libr4d and exl3i, only when given a HIP compiler) and requires the
+1 -1
View File
@@ -182,7 +182,7 @@ Set these in `.env`:
| `RADIANCE_UID`, `RADIANCE_GID` | `id -u`, `id -g` |
| `RENDER_GID`, `VIDEO_GID` | `getent group render \| cut -d: -f3`, the same for `video` |
`tp2.yaml` serves eleven models from one container, each under its entry's name in the `models:`
`tp2.yaml` serves ten models from one container, each under its entry's name in the `models:`
block of `tp2.radiance.yaml` beside it. With only Flash-Next's container downloaded, delete every entry there but
`flashnext` (the request below names no model, which a file of one model answers with that one).
-149
View File
@@ -1,149 +0,0 @@
# Qwen3 embeddings and reranking
Radiance serves Qwen3-Embedding and Qwen3-Reranker at BF16 and TP1 in 0.6B, 4B and 8B.
Use the original SafeTensors checkpoint directories or converted `.rad` files.
See the [architecture notes](ARCHITECTURES.md)
for the model graph and scoring details.
## Convert to `.rad`
Build Radiance in Linux/WSL (`RAD_WITH_HIP=OFF` for CPU). From the repository root:
```sh
export RADIANCE_HOME="$PWD/build/radiance_home"
CHECKPOINT_ROOT=/srv/models/Qwen
build/bin/rad-convert "$CHECKPOINT_ROOT/Qwen3-Embedding-0.6B" \
-o qwen3-embedding-0.6b-bf16.rad --max-ctx 8192
build/bin/rad-convert "$CHECKPOINT_ROOT/Qwen3-Reranker-0.6B" \
-o qwen3-reranker-0.6b-bf16.rad --max-ctx 8192
```
The default conversion keeps BF16 weights. `1_Pooling/config.json` selects embeddings.
`1_LogitScore/config.json` selects reranking and supplies the `yes` and `no` token IDs.
Conversion preserves those settings, the tokenizer and named embedding prompts.
If module configs are missing, conversion accepts `--set retrieval.type=embedding`,
or `--set retrieval.type=rerank --set logit_score.true_token_id=9693
--set logit_score.false_token_id=2152`. These IDs apply to Qwen3-Reranker-0.6B.
## Serve
Copy the `qwen3-embedding` and `qwen3-reranker` entries from the
[TP1 example](../deploy/compose/tp1.radiance.yaml) into the `models` section of
`qwen3.radiance.yaml`. Point each `model` at its checkpoint directory or `.rad` file.
Use `server.host: 127.0.0.1` and `server.port: 8000` for the local requests below.
```sh
RADIANCE_HOME="$PWD/build/radiance_home" build/bin/radiance --config qwen3.radiance.yaml
```
Set `server.kernels` to the installed libraries for your device or let Radiance select them.
| Device | `server.kernels` |
| --- | --- |
| CPU | `libavx` |
| RDNA4 | `libr4d` |
| RDNA3 | `libr3d` |
| Strix Halo (`gfx1151`) | `libhalo,libr3d` |
Each embedding input or reranking pair must fit in one step. The smaller of
`max-model-len` and `max-num-batched-tokens` caps the encoded input, including
prompt text and special tokens. The TP1 examples set both to 8192.
For container builds and the one-card deployment, see the [Docker guide](DOCKER.md#compose).
## Requests and outputs
```sh
curl http://localhost:8000/v1/embeddings -H 'Content-Type: application/json' \
-d '{"model":"qwen3-embedding","input":"Where can I borrow books?","prompt_name":"query"}'
curl http://localhost:8000/v1/embeddings -H 'Content-Type: application/json' \
-d '{"model":"qwen3-embedding","input":["A library lends books.","A football match."],"prompt_name":"document"}'
curl http://localhost:8000/v1/rerank -H 'Content-Type: application/json' \
-d '{"model":"qwen3-reranker","query":"Where can I borrow books?","documents":["A library lends books.","A football match."],"top_n":2}'
```
Embeddings return a normalised vector with 1024, 2560 or 4096 dimensions for the
0.6B, 4B and 8B checkpoints respectively. `dimensions` truncates and renormalises it.
For text inputs, the last pooled token follows the checkpoint's tokenizer post-processor.
`prompt_name: query` uses the checkpoint's instruction prefix; `document` adds
nothing. Raw token arrays are already formatted and receive no prefix.
Reranking formats each query/document pair with the Qwen3 prompt, including
the empty thinking block. `instruction` can replace the default retrieval instruction.
Documents must be strings. Results are sorted by descending relevance, preserve
the original document indices, and support `top_n` and `return_documents`.
In the example, the library document should rank first.
## Validation
`tests/mkqwen3retrievalgolden.py` is an offline Transformers oracle; the stored
fixture records dependency versions. C++ end-to-end tests exercise native loading
and conversion, causal mixed-length batches, last-token pooling, named prompts,
dimension truncation, scores, sorting, token usage and context rejection on
`libref` and `libavx`.
```sh
ctest --test-dir build -R checkpoint_test --output-on-failure
RADIANCE_HOME="$PWD/build/radiance_home" build/tests/engine_e2e_test qwen3
```
On a GPU build, run the mixed-length parity test with the kernel list for that
card. It compares native host inference with converted weights on the GPU.
Set `ROCR_VISIBLE_DEVICES` to select a card when needed.
```sh
RAD_QWEN3_GPU_KERNELS=libr4d build/tests/engine_e2e_test qwen3_retrieval_gpu_matches_host
```
With PyTorch and Transformers installed in your Python environment,
`tests/qwen3_retrieval_reference.py` generates a BF16 SDPA reference from the
local checkpoints and compares it with a running server. It checks exact
prompt token counts, absolute rerank score error below 0.015, and embedding
cosine similarity above 0.999.
```bash
CHECKPOINT_ROOT=/srv/models/Qwen
SIZE=0.6B # Also accepts 4B or 8B. Serve the matching pair before running this loop.
for task in Embedding Reranker; do
name="${task,,}"
checkpoint="$CHECKPOINT_ROOT/Qwen3-$task-$SIZE"
reference="/tmp/qwen3-$name-$SIZE-reference.json"
python3 tests/qwen3_retrieval_reference.py "$checkpoint" "$reference" &&
python3 tests/qwen3_retrieval_reference.py "$checkpoint" "$reference" \
--url http://127.0.0.1:8000 --model "qwen3-$name" || break
done
```
## Experimental FFN-only IQ8R for 8B
This variant quantizes `gate_up` and `ffn_down` by round-to-nearest after a
128-column Hadamard rotation. It stores INT8 codes with one BF16 scale per
128 columns. Attention, the token table, norms and reranking score rows keep
their existing precision. The converter writes a separate descriptor for the
`qwen3_embed_ffn_iq8r` plugin.
```bash
cmake --build build-gpu --parallel 4 --target qwen3_embed_ffn_iq8r rad-convert engine_e2e_test
export RADIANCE_HOME="$PWD/build-gpu/radiance_home"
CHECKPOINT_ROOT=/srv/models/Qwen
for task in Embedding Reranker; do
build-gpu/bin/rad-convert "$CHECKPOINT_ROOT/Qwen3-$task-8B" \
--recipe data/recipes/qwen3-retrieval-ffn-iq8r-rtn.recipe \
--set quantization_config.quant_method=w8a8 \
--set quantization_config.fmt=ffn_fwht128 \
--max-ctx 8192 -o "qwen3-${task,,}-8b-ffn-iq8r.rad" || break
done
```
For RDNA4, serve the converted files with `server.kernels: libr4d`. Use the same
GPU, request mix, batch limits and warm-up as the BF16 `.rad` run. Set `SIZE=8B`
in the validation loop above and use the same reference JSON for both server
runs. Check score and ranking agreement before comparing input tokens/s.
The synthetic parity test also exercises the FFN-only path when enabled.
```sh
ROCR_VISIBLE_DEVICES=0 RAD_QWEN3_GPU_KERNELS=libr4d RAD_QWEN3_GPU_FFN_IQ8R=1 \
build-gpu/tests/engine_e2e_test qwen3_retrieval_gpu_matches_host
```
-78
View File
@@ -1,78 +0,0 @@
# Qwen3-VL text generation and visual QA
The dense `qwen3vl` plugin serves ordinary text-only chat and writing, or the same
chat API with images for captions and visual questions. An image is optional.
This is a language model with a vision tower, rather than an image generator.
The initial conversion targets
[Qwen3-VL-32B-Instruct-abliterated-v1](https://huggingface.co/prithivMLmods/Qwen3-VL-32B-Instruct-abliterated-v1),
revision `251bcf1a0806c895d33a1714b41f56afd5f406cf`. Accept its access conditions
before downloading. Its upstream model license still applies. No control vector
is bundled with the converted checkpoint.
Convert its BF16 checkpoint using the same signed INT4/F16 group-scale grid used
by the Gemma W4A8 recipe. The text projections use INT8 activations; the vision
tower, embeddings, output head and normalization weights retain their reference
precision. Quantization changes the model's numbers.
```sh
build/bin/rad-convert /srv/models/hf/Qwen3-VL-32B-Instruct-abliterated-v1 \
-o /srv/models/qwen3-vl-32b-instruct-abliterated-w4a8.rad \
--recipe data/recipes/qwen3vl-32b-w4a8.recipe --max-ctx 262144
```
The conversion context bound does not reserve a serving KV pool. Set a practical
serving bound separately. Dense attention KV grows with context length; available
memory, concurrent sequences, and other resident models still constrain capacity.
The plugin has no paired speculative drafter.
Add an entry to an existing Fleet file, adjusting the path:
```yaml
models:
qwen3-vl-32b-abliterated:
model: /srv/models/qwen3-vl-32b-instruct-abliterated-w4a8.rad
tp: 2
max-model-len: 32768
max-num-seqs: 2
max-num-batched-tokens: 1024
num-speculative-tokens: 0
mm-max-patches: 4096
image-max-pixels: 1048576
park: {ram: allowed}
```
If a group already makes the other secondary models exclusive, add this entry's
name to that group's `exclusive` list as well. Keep the primary model's own
context and caching settings. `mm-max-patches: 0` disables vision for a text-only
profile. Otherwise, keep the vision tower enabled to accept image parts.
Text-only generation uses the usual endpoint:
```json
{
"model": "qwen3-vl-32b-abliterated",
"messages": [{"role": "user", "content": "Write a short introduction to this manual."}],
"max_tokens": 512
}
```
For visual QA, send the same request to `/v1/chat/completions` with a content array:
```json
{
"model": "qwen3-vl-32b-abliterated",
"messages": [{
"role": "user",
"content": [
{"type": "text", "text": "Describe the scene and read any visible text."},
{"type": "image_url", "image_url": {"url": "data:image/png;base64,<encoded PNG>"}}
]
}],
"max_tokens": 512
}
```
Build the engine and every loaded plugin together: DeepStack feature transport
changes the encoder feature layout. The release assigns the ABI version; rebuild
the engine and every plugin together. Older layouts are rejected by the fingerprint check.
+87 -1174
View File
File diff suppressed because it is too large. Load diff
+8
View File
@@ -202,3 +202,11 @@ changes the order the all-reduce sums in, and near-ties flip.
`tools/pad_tp.py` pads a checkpoint for an engine without an attention world (zero heads appended
so that 36 / 3 / 18 / 54 divide, at the cost of a second container and of computing zeros), and
`tools/pad_verify.py` verifies a pad; radiance needs neither.
## Four-rank PCIe notes (`tp: 4`)
On 4x R9700 (PCIe Gen5 P2P, no NVLink):
- **`prefill-span: 2`** overlaps half-chunk all-reduces with compute (+5–11% prefill under `all_vram` and `checkpoint-interval: 2048`).
- **`ar_*_4rank` link-hold release** keeps yielding DMAs (stager copies, expert prefetch) from stalling behind collectives (+3.7% at c8).
- **`tp-wire: wht6`** (`ti8` two-shot) runs near PCIe Gen5 x16 line rate (~60 GB/s peer push); `tp-wire: exact` is only faster at very small decode steps (≤25 tokens, which it already serves).
- **`checkpoint-interval: 4096`** with an 8192-token budget trades ~2–4% prefill for +2–3% decode throughput at c8.
-62
View File
@@ -1,62 +0,0 @@
# Four ranks on a PCIe fabric: what pays and what doesn't
Every TP4 lever tried on 4x R9700 (PCIe Gen5 P2P, no NVLink), and what decided it. Use it before
re-attacking the same ground on another card or fabric. All numbers are paired within-session
windows (bar 0.5% plus a sign test) at `prefill-span: 2`, `tp-wire: wht6`, `placement: all_vram`,
iq4r MoE, unless stated.
Shorthand: `pp` prefill; `c8` eight concurrent streams; `M` rows in a collective; `ti8` the int8
peer wire (`tp-wire: wht6`'s coding); `hc_write` the fused all-reduce + residual-write row.
## What shipped
- **`prefill-span: 2`**: overlaps the two half-chunk all-reduces with compute through the second
lane's rows. +5-11% pp, but only with `checkpoint-interval: 2048` and `all_vram` (placement flips
its sign).
- **The four-rank link-hold release** (`ar_*_4rank` rows release the link gate themselves, as the
two-rank rows do). Without it every yielding DMA (stager copies, expert prefetch) idles behind
each collective: removing it costs 3.7% at c8. Any new collective row must honour the gate.
- **Four-rank selftest coverage**: the wide-collective and fused-write cases at world 4.
## What was tried and lost
| lever | result | why it is closed |
|---|---|---|
| widen the MoE fast band to four classes | no change | the cap only bites 3-bit formats; inert for 4-bit experts |
| fused all-reduce + `hc_write` on the exact-wire band | never selected | `wht6` takes the lossy band, and the fused row is exact-only. Never timed in its own territory |
| per-class grid split for the MoE GEMM | not constructible in one launch | a run's class is not a property of `blockIdx.y`. A two-launch split was never tried |
| fused `ti8` two-shot + `hc_write` | c8 -0.43%, c16 sign-split | the saved launches sit at the ~4 us launch floor; the epilogue serialises behind the all-reduce spin |
| more all-reduce blocks (16 -> 32 -> 64) | GB/s falls (M=2048: 34.5 -> 31.4; M=128: 18.4 -> 7.4) | handshake-bound, not launch-starved |
| `tp-wire: exact` everywhere | -7.6 to -8.3% at span off | exact wins only at decode steps of 25 tokens or fewer, which it already serves |
| rank-load balancer | +1.3% at 64K only | changes output bits; not worth it |
| step-graph capture | none for the trunk | trunk submission is device backpressure, so the host is hidden. Evidence is a synthetic ring, not an engine capture |
| `ti8` MoE gather row | premise false | on the lossy wire the gather's all-reduce already rides `ti8` |
| faster `ti8` codec | none possible | encode is 4% of the row (36 of ~900 us); the peer push runs at ~60 GB/s, PCIe Gen5 x16 line rate. The "22% tax" against exact is the link |
Only a lever that ran correctly and still lost to a measured mechanism is closed for good: the
block count, the `ti8` fusion and the codec. The fused exact-wire rows, the two-launch class split
and draft-pass graph capture were never built or never timed where they would pay.
## Open levers, ranked
1. **Bigger steps for decode-heavy traffic**: `checkpoint-interval: 4096` with an 8192-token budget
measured +2-3% c8 and -2-4% pp. Two flags, no code. A prefill chunk is
`min(budget, interval x span)`; the engine prints the effective chunk at startup.
2. **Fused gather/write rows for exact-wire configs**, where they still have territory.
3. **The span floor at TP4 with tiered experts**: eight checkpoint intervals, priced on Flash-Next at
TP2 only.
4. **A one-shot `ti8` band for 128-512 KiB messages**, which now pay the two-shot's 1.5N and two
syncs.
5. **Draft-pass graph capture**, if low-concurrency latency matters: the host gap is real at c1/c2
and hidden at c8.
6. **The dense pipelined prefill at four ranks** (`qwen35_fp8`, `qwen35_w8a8`; GUIDE
§4.5). It runs at two ranks only (`g.world == 2` in the plugins' declare); enabling it needs a
timing against the serial step at 18K-64K prompts.
## Instruments
- `debug-graph: true` lists which row each op resolves to. It lists declared bands, so confirm
against the running step.
- `r4d_selftest --perfops` times small ops (every elementwise op costs ~4-4.6 us regardless of
payload); `--perfhc` and the GEMM/MoE modes time the rest.
- `rad-kbench` for kernel-against-reference replay; BetterBench's fixed profile decides promotion.
-37
View File
@@ -1,37 +0,0 @@
# Wan 2.2 TI2V-5B
The `wan` architecture serves text-to-video and first-frame image-to-video through `/v1/videos`. It produces MP4 video at 24 fps. The decoder emits one frame from its first chunk and four from each subsequent chunk, giving `4 × chunks − 3` frames. This implementation allows up to 31 chunks and an output area of 1280 × 704 pixels, with sides divisible by 32 and aspect ratio up to 4. These declaration bounds still need qualification for each memory profile.
The default output is 512 × 288 with 49 frames. Generation uses the shifted flow UniPC BH2 solver, shift 5, 50 model evaluations and CFG scale 5. The API accepts `num_inference_steps`, `guidance_scale`, `negative_prompt`, and `seed`.
## Conversion
Convert the pinned Diffusers directory with the bundled recipe. It keeps the timestep projections, modulation tables, normalization gains and velocity head in FP32, and stores the UMT5 encoder, other transformer weights and VAE in BF16.
```sh
rad-convert /models/Wan2.2-TI2V-5B-Diffusers \
--recipe data/recipes/wan-2.2-ti2v-5b-bf16.recipe \
-o /models/wan-2.2-ti2v-5b-bf16.rad
```
The source checkpoint and inference implementation are pinned independently. [Checkpoint](https://huggingface.co/Wan-AI/Wan2.2-TI2V-5B-Diffusers/tree/b8fff7315c768468a5333511427288870b2e9635) · [Reference implementation](https://github.com/Wan-Video/Wan2.2/tree/1ea34ff48f87168174e12956e200b1d908b1c5ff)
## Serving
Give the generator a batch budget of at least 32768 rows to cover its largest declared pass.
```yaml
models:
wan:
model: /models/wan-2.2-ti2v-5b-bf16.rad
tp: 1
max-num-batched-tokens: 32768
```
Create a video with the normal asynchronous API, poll the returned job ID, then fetch `/v1/videos/JOB_ID/content`. An `input_reference` image selects first-frame generation. The first frame is encoded by the VAE and its latent is restored after every sampler update.
```json
{"model":"wan","prompt":"A red ceramic mug on a table, camera slowly moving closer.","size":"512x320","seconds":2,"num_inference_steps":50,"guidance_scale":5,"sampler":"unipc","seed":42}
```
The checkpoint retains its own license and attribution. Runtime and model licensing must be reviewed separately.
+1 -1
View File
@@ -1,4 +1,4 @@
/* avx_wan.cpp -- Wan 2.2 TI2V's ops (docs/WAN.md): the UMT5 text encoder's attention and gelu, the
/* avx_wan.cpp -- Wan 2.2 TI2V's ops (docs/ARCHITECTURES.md): the UMT5 text encoder's attention and gelu, the
* diffusion transformer's timestep embedding, rotary table and rotation, modulated norm and gated
* residual, its patch unfold and UniPC sampler step, and the VAE decoder's frame offsets, causal
* history and temporal shuffle.
+83 -51
View File
@@ -6,8 +6,10 @@ the architecture and the kernels. Python appears only in a few offline helpers
Device code belongs to plugins, not to the core. `RAD_WITH_HIP` is `ON | OFF | AUTO`, and a
host-only build with no device kernels is a supported configuration that exercises everything
except the device kernels. Three kernel libraries are in the tree and only one is HIP: `libr4d` for
AMD RDNA4, `libavx` in hand-written x86 SIMD, and `libref` in plain C++.
except the device kernels. Five core kernel libraries are in the tree — three HIP (`libr4d` for
AMD RDNA4, `libhalo` for RDNA 3/3.5 WMMA, and `libr3d` for RDNA3), `libavx` in hand-written x86
SIMD, and `libref` in plain C++ — alongside specialized kernel plugins under `plugin/` (`exl3i`,
`glm`, `spechub`, `lora_plain`).
## Why
@@ -35,18 +37,20 @@ option was to patch the source. Here each has a designed extension point.
## Scope
**In:** continuous batching, paged KV, prefix caching, tensor parallelism, speculative decoding,
hybrid KV (full, sliding-window and linear-attention state in one model), weight placement across
VRAM, RAM and SSD with runtime re-placement, a server for OpenAI, Anthropic and llama-server
clients, embeddings, image generation, a quantiser, and PEFT LoRA adapters served beside the base
model and picked per request (`docs/GUIDE.md` §4.9.1).
hybrid KV (full, sliding-window, ring and linear-attention state in one model), weight placement
across VRAM, RAM and SSD with runtime re-placement, a server for OpenAI, Anthropic and llama-server
clients, embeddings and reranking, image, video, speech, music and 3D shape generation, ASR and
realtime transcription, a quantiser, control vectors, and PEFT LoRA adapters served beside the base
model and picked per request (`docs/GUIDE.md`).
**Multimodal (§11).** Pictures and video on the Qwen and Gemma 4 plugins, pictures on LFM2-VL,
and pictures, video and audio as EmbeddingGemma 2 input. The encoder is declared by the language
model's own architecture plugin, its output travels in the step batch, and a picture is a
prefix-cache hit by content.
**Multimodal (§11).** Pictures, video and audio across ten processor families (`core/mm/processor.h`),
including Qwen-VL, Gemma 4, LFM2-VL, GLM-5.3, Pixtral, Muse Glimmer, Inkling 2, DeepSeek-V4.1,
Unlimited-OCR and EmbeddingGemma 2. The encoder is declared by the language model's own architecture
plugin, its output travels in the step batch, and a picture is a prefix-cache hit by content.
**Large MoE models.** Heat-driven expert placement (§5.4) and the 4-bit expert formats
(`docs/MOE-W4.md`) serve Qwen3.8-Flash-Next. DeepSeek-V4-Flash is not ported.
**Large MoE models.** Heat-driven expert placement (§5.4) and the low-bit expert formats
(`docs/MOE-W4.md`, `docs/IQR.md`) serve Qwen3.8-Flash-Next, DeepSeek-V4.1-Flash (`deepseek41`),
GLM-5.3-Flash (`glm5next`) and ERNIE-5.5-Flash (`ernie55`).
**Out:** training, pipeline parallelism, CUDA, disaggregated prefill. None is designed out and
none is designed for.
@@ -54,8 +58,9 @@ none is designed for.
**Hardware.** Everything above the device layer learns the machine at run time (architecture,
compute units, wave width, LDS, VRAM). Everything that must be written per card is a kernel
library, a plugin selected per op against declared constraints (§2.1). The shipped device
library, `libr4d`, covers AMD RDNA4 (`gfx12xx`), the hardware the engine is measured on. A card no
installed library covers is refused at startup with the unserved ops named (§17).
libraries cover AMD RDNA4 (`libr4d`: `gfx12xx`), RDNA 3/3.5 (`libhalo` and `libr3d`: `gfx11xx`),
and RDNA4 EXL3-V3 linears (`plugin/exl3i`). A card no installed library covers is refused at
startup with the unserved ops named (§17).
---
@@ -91,13 +96,17 @@ Three kinds, loaded from `$RADIANCE_HOME`: kernels (§2.1), architectures (§2.4
(§4.5). All are C ABI only: C++ across an `.so` boundary invites mismatches that surface as
corruption far from their cause, and this boundary is where users substitute their own builds.
Every plugin exports a version symbol and is refused on mismatch:
Every plugin exports version, layout-fingerprint and metadata symbols and is refused on mismatch:
```c
uint32_t rad_plugin_abi_version(void); /* must equal RAD_ABI_VERSION */
uint64_t rad_plugin_abi_layout(void); /* structural layout fingerprint (abi/rad_abi_layout.h) */
const RadPluginInfo* rad_plugin_info(void);
```
Kernel plugins may also export `rad_plugin_open` and `rad_plugin_close` to decline unsupported
devices at load.
### 2.1 Kernel plugins
`$RADIANCE_HOME/kernels/*.so`. Each provides any number of kernels as **rows**, exported through
@@ -151,6 +160,7 @@ struct RadKernelInfo {
RadShapeFn opd_shape; /* how to size and fill each operand, for a tool calling it cold */
RadUnrelayoutFn unrelayout;/* the inverse, so a stored weight can be read back */
RadFuseFn replaces; /* the chain of conventional ops this kernel does in one launch */
uint64_t capabilities; /* RAD_KERNEL_CAP_* feature flags (dynamic prefill split, cvec) */
};
```
@@ -214,6 +224,8 @@ struct RadArgs {
void* instance; /* whatever init() returned for this resolved instance */
int rank; /* tensor-parallel rank and world size, for collectives */
int world_size;
int32_t kv_used_max_h; /* max active KV length in the step batch */
int32_t wgp_count; /* target device WGP count for occupancy sizing */
};
```
@@ -355,16 +367,19 @@ void rad_arch_step(RadCtx* c, const RadBatch* batch);
draft depth: `RadArchProbe{draft_depth, draft_depth_fixed}` resolves `num-speculative-tokens:
auto` (§10) before declare, because `RadBuildCtx::max_spec` sizes buffers, bands kernels and sets
the scheduler's window; otherwise the core would read the drafter's configuration keys itself. The
probe also reports sizing-declare support (`shape_probe_ok`, §3.1), the encoder's merge, the audio
encoder's longest clip and an image generator's pass sizes. Without the export every answer is
zero, so `auto` resolves to 0.
probe also reports sizing-declare support (`shape_probe_ok`, §3.1), encoder geometry, audio/video/
image/shape generator sizing, and capability flags (`kv_fp8_ok`, `kv_stream_ok`,
`control_vector_ok`, `state_f16_ok`, `tree_pays`, `chain_pays`, `ckpt_snap_ok`, `tp_attn_rows_ok`).
Without the export every answer is zero, so `auto` resolves to 0. Architecture plugins may also
supply optional hooks for audio/video/text preparation, multi-instance serving, and custom pass
keys (`abi/rad_abi.h`).
`RadBuildCtx` carries `rank` and `world_size` (declare runs per rank with dimensions already
divided, §9); the deployment's bounds `max_tok`, `max_seqs`, `max_ctx`, `max_spec`,
`max_enc_patches` and `max_audio_frames`, so buffers are sized for the worst step; the
tensor-parallel wire choice `tp_wire_lossy` and its `tp_wire_min_bytes` cutover (§9); `kv_dtype`;
`shape_probe` (§3.1); and `is_draft` / `scope`, which say whether this builder scope is the
model, a drafter or an encoder.
tensor-parallel wire choice `tp_wire_lossy` and its `tp_wire_min_bytes` cutover (§9); `kv_dtype`
(`RAD_BF16`, `RAD_I8`, `RAD_F8E4M3`, `RAD_I4R`, `RAD_I6R`); `shape_probe` (§3.1); and
`is_draft` / `scope`, which say whether this builder scope is the model, a drafter or an encoder.
---
@@ -490,8 +505,8 @@ The container stores encodings only, in one canonical arrangement, and the kerne
rearranges them at load (§4.3). A library may change every layout without touching a container;
only a change in the numbers requires converting again. The kernel-specific part is small: in a
Qwen3.8-Flash-Next container with int4 experts, 94% of the bytes (the experts and the fp8 n-gram
table) are canonical as stored and about 3 GiB are kernel-permuted, while 82% of Qwen3.8-27B-FP8's
bytes are fp8 the checkpoint holds row-major and its kernels read fragment-ordered.
table) are canonical as stored and about 3 GiB are kernel-permuted, while most of an IQ8R dense
trunk's bytes are row-major int8 codes that device kernels rearrange into fragment order at load.
**An encoding is data, not an enum value** (`abi/rad_encoding.h`), so a quantiser can define one
without a core change:
@@ -521,7 +536,8 @@ codebook, a lattice grid or a transform's parameters, carried whole by every sli
narrower than a byte or not a power of two wide are a bit stream along the row, lowest bits first,
each row starting on a byte. The dtypes are f32, bf16, f16, fp8 e4m3 and e5m2, fp6 e2m3 and e3m2,
fp4 e2m1, e8m0, signed and unsigned integers of every width from one bit to eight plus 16 and 32,
and 9- to 12-bit unsigned for lattice indices.
9- to 12-bit unsigned for lattice indices, and rotated int4/int6 KV cache-row dtypes (`RAD_I4R`,
`RAD_I6R`).
`plain` is a single `codes` plane whose value is the code. `affine` is the scheme the core decodes,
and it covers every format in common use:
@@ -636,7 +652,7 @@ of several planes. So one declaration serves a bf16 head with the bf16 GEMM and
the int8 one.
Relayout is host code on a thread pool behind the load sweep, and must keep pace with the disk
(Qwen3.8-27B-FP8 rearranges about 24 GiB of its 29 at every load). The sweep only reads, with
(a 27B IQ8R container rearranges ~24 GiB of its 29 GiB at every load). The sweep only reads, with
`O_DIRECT` into a ring of pinned windows; the pool makes the host copies out of the windows and the
relayouts, in memory reused from weight to weight.
@@ -648,8 +664,8 @@ says so by name. The n-gram table, the weight these tiers exist for, has the ide
is a source like a container: the name map (§2.4) resolves each declared weight to checkpoint
tensors, concatenations and expert slices included, the reader states their encodings, and the
same path runs. Trivial means read as stored (the plugin then accepts or refuses the encoding as it
would a container's: block FP8 and MXFP4 trunk weights are refused, `linear_retired` in
`arch/common/rad_linear.h`):
would a container's: block FP8, MXFP4 trunk weights, M2XFP4 and ParoQuant are refused,
`linear_retired` in `arch/common/rad_linear.h`):
- `bf16`, `f16` and `f32`, and the exact widenings between them (a bf16 norm the plugin reads as
f32);
@@ -763,6 +779,7 @@ Each algorithm pairs with any grid it makes sense for, and a recipe names all th
|---|---|---|---|
| `rtn` | round to nearest; `rule` absmax, mx, fixed or search | every one below | the grid |
| `gptq` | error feedback against H; `act_order=1`; `cd=N` sweeps of coordinate descent after it | every one | the grid, `perm` under act order |
| `gptqsim` | runs `gptq` on any grid, stores the decoded values as plain `bf16` for W16A16 measurement | every one | `plain` (`bf16`) |
| `awq` | per-column activation scales searched against H, then a per-block clip | every untransformed one | the grid and a last scale level `[* x 1]` |
| `autoround` | sign-gradient descent on rounding offsets and block ranges against H | integer codes, row blocks, one level | the grid |
| `paroquant` | Givens pair rotations and channel scales fitted against H, then AutoRound | every untransformed one | the grid and a `givens` transform |
@@ -1037,9 +1054,9 @@ a kernel change needs no core edit.
Hybrid models are the normal case: Qwen3.5-27B has 48 linear-attention and 16 full-attention
layers, and Gemma 4 interleaves sliding-window and global layers. Each state kind is a **KV group**
(`RAD_KV_FULL`, `RAD_KV_WINDOW`, `RAD_KV_LINEAR`, `RAD_KV_CONV`) with its own block geometry, pool
and slot mapping in the step batch, so there is no common page size to pad layer bundles to (the
padding vLLM's KV-group-sizing patch in the table at the top works around).
(`RAD_KV_FULL`, `RAD_KV_WINDOW`, `RAD_KV_RING`, `RAD_KV_LINEAR`, `RAD_KV_CONV`) with its own block
geometry, pool and slot mapping in the step batch, so there is no common page size to pad layer
bundles to (the padding vLLM's KV-group-sizing patch in the table at the top works around).
Linear-attention state (GDN recurrent state, conv state) is per-sequence and fixed-size rather
than per-token, but it is a KV group too, allocated, mapped and freed by the same manager, so one
@@ -1329,16 +1346,19 @@ of a linear-attention kernel pair's schema (`docs/OPS.md`).
## 11. Multimodal
**Coverage.** Pictures and video on every Qwen container that carries the vision tower
(Qwen3.8-27B in bf16 and fp8, Qwen3.6-35B-A3B, Qwen3.8-Flash-Next) and on Gemma 4 31B
(`gemma4_bf16`); pictures on LFM2-VL and GLM-5.3-Flash; pictures, video and audio as EmbeddingGemma
2 input. Media
(Qwen3.8-27B, Qwen3.6-35B-A3B, Qwen3.8-Flash-Next, Qwen3-VL) and on Gemma 4 (`gemma4_bf16`,
`gemma4_exl3`); pictures on LFM2-VL, GLM-5.3-Flash, Muse Glimmer, Inkling 2, DeepSeek-V4.1,
Unlimited-OCR and Nemotron-3.5-Embed; pictures, video and audio as EmbeddingGemma 2 input; audio
on Qwen3-ASR and Gemma 4 E2B/E4B. Media
arrive as `image_url` / `video_url` chat parts (`input_image` / `input_video` in the Responses
API) and audio as `input_audio` / `audio_url`, as `data:` URLs only: fetching a caller's URL would
make the server an SSRF proxy.
**The processor is `core/mm/`.** One decoder (libavformat/libavcodec) reads every image and video
format from a memory buffer, with an empty protocol whitelist, and converts at the frame's own
colour matrix and range. The family comes from the container (`core/mm/processor.h`):
colour matrix and range. The family comes from the container (`core/mm/processor.h` defines ten
families: `QwenVL`, `Gemma4`, `Lfm2`, `UnlimitedOcr`, `Glm5Next`, `Pixtral`, `Radio`,
`MuseGlimmer`, `Inkling2` and `DeepSeek41`):
- **Qwen-VL.** `smart_resize` fits a picture to multiples of patch x merge within its pixel band,
resampled with PIL's antialiased bicubic; patches are normalised, in merge-block order, a picture
@@ -1408,7 +1428,7 @@ commit, the split and the reason for every row:
|---|---|---|
| Jinja engine | `common/jinja/` | lifted, 5.0k |
| template capability probe | `common/jinja/caps.cpp` | lifted, 0.5k |
| reply format analysis | `chat.cpp`, `chat-auto-parser*.cpp`, `chat-diff-analyzer.cpp` | lifted, most of the patch series; the markers only |
| reply format analysis | `chat.cpp`, `chat-auto-parser*.cpp`, `chat-diff-analyzer.cpp` | lifted and maintained in place under `vendor/`; the markers only |
| reply parsing | `chat-peg-parser.cpp`, `peg-parser.cpp` | rewritten → `core/text/chatparse.{h,cpp}`, one streaming pass |
| JSON-schema → grammar | `json-schema-to-grammar.cpp` | lifted, 1.2k |
| unicode and regex splitting | `common/unicode.cpp`, `src/unicode*` | lifted |
@@ -1528,11 +1548,14 @@ states.
## 14. Server
OpenAI's API: `/v1/chat/completions` (streaming and not), `/v1/completions`, `/v1/models` and
`/v1/models/:id`, `/v1/embeddings`, `/v1/images/generations` and `/v1/images/edits`, with tool
calls in and out and logprobs. `/v1/systemone` serves the decisions of LiquidAI's d1 when the
container declares it. A Prometheus `/metrics` endpoint uses vLLM's metric names, so existing
dashboards work.
OpenAI's API: `/v1/chat/completions` (streaming and not, plus `/input_tokens`), `/v1/completions`,
`/v1/models` and `/v1/models/*id`, `/v1/embeddings`, `/v1/rerank`, `/v1/images/generations` and
`/v1/images/edits`, `/v1/audio/speech` (plus `/v1/audio/speech/stream` WebSocket),
`/v1/audio/transcriptions`, `/v1/realtime` (WebSocket), and `/v1/videos` (`GET`/`POST`/`DELETE`
and `/content`), with tool calls in and out and logprobs. `/v1/systemone` (alias `/v1/decisions`)
serves decision models when the container declares it; `/generate`, `/send` and `/status/:uid`
serve 3D shape generation (Hunyuan3D-2). A Prometheus `/metrics` endpoint uses vLLM's metric names,
so existing dashboards work.
Other clients' APIs are translated onto the same chat request rather than served by a second path:
Anthropic's `/v1/messages` (and `/v1/messages/count_tokens`), OpenAI's `/v1/responses`, and
@@ -1553,8 +1576,11 @@ send beta fields that change what a request means (a `thread` continuation carri
the conversation), so a field is read, taken because it cannot change the answer here, or refused
by name (GUIDE §5.11).
The operational set: `/health`, `/ping`, `/load`, `/version`, `/server_info`, `/diagnostics`,
`/tokenize`, `/detokenize`, `/get_tokenizer_info`, `/reset_prefix_cache`. Methods follow vLLM's:
The operational and admin set: `/health`, `/ping`, `/load`, `/version`, `/server_info`,
`/diagnostics`, `/tokenize`, `/detokenize`, `/get_tokenizer_info`, `/reset_prefix_cache`,
`/v1/loras` (plus `/v1/loras/validate`, `/v1/load_lora_adapter`, `/v1/unload_lora_adapter`),
`/admin/max-in-flight`, `/admin/control-vector[s]`, `DELETE /sessions[/:label]`, and fleet routes
`/admin/fleet`, `/admin/reload` and `/admin/models/:name/:action`. Methods follow vLLM's:
`/tokenize` and `/detokenize` are POST (their input is a body), `/reset_prefix_cache` is POST (it
changes state), and `/ping` takes GET and POST because load balancers differ. `/server_info`
answers from the one route table.
@@ -1712,27 +1738,33 @@ pins it (§19.7). Under `prefix-resume: exact` a prefix hit is held to the cold
```
radiance/
core/ engine, scheduler, placement, sampler, server
core/ engine, scheduler, placement, sampler, server, fleet
abi/ the C ABI -- the only thing plugins compile against
arch/ architecture plugins, one directory each
libr4d/ the RDNA4 (gfx12xx) kernel library -- ships with the engine
libhalo/ the RDNA 3/3.5 (gfx11xx) WMMA kernel library
libr3d/ the RDNA3 (gfx11xx) kernel library
libref/ the conventional vocabulary in plain C++: the oracle, an opt-in last resort
libavx/ the same vocabulary in x86 SIMD, dispatched by CPU feature: the production host
kernels, built on every x86-64 build
libquant/ the built-in quantisers (§4.5), host C++ and trellis GPTQ on the card, a plugin
like any other
tools/ rad-convert, rad-kbench, rad-tune, rad-info, rad-schemas, rad-tokcheck,
rad-chatparse, rad-gbnf-check
plugin/ first-party optional/specialized plugins (exl3i, exl3quant, *_exl3, glm,
spechub, lora_plain)
tools/ rad-convert, rad-sidecar, rad-kbench, rad-tune, rad-info, rad-schemas,
rad-tokcheck, rad-yaml, rad-export, rad-chatparse, rad-gbnf-check
dashboard/ React/Vite web UI, embedded into the server binary
integrations/ external client integrations (ComfyUI)
tests/ the suite; runs in full on the host backend
scripts/ shell harnesses for serving, tracing and profiling a running engine
data/ the conversion recipes, and recorded kernel references rad-kbench replays with
no model present
docs/ the user guide, the tools reference, the op vocabulary, the plugin contract,
the kernel report
deploy/ compose files and the Grafana dashboard
data/ the conversion recipes, codebooks, control vectors, and recorded kernel
references rad-kbench replays with no model present
docs/ the user guide, the tools reference, the op vocabulary, the plugin contract
deploy/ compose files, chat templates and the Grafana dashboard
docker/ the container image's build files
cmake/ the find_package config and rad_add_plugin, shared with out-of-tree plugins
vendor/ llama.cpp lifts, tracked to an upstream commit, patched not edited
vendor/ llama.cpp and cpp-httplib lifts, tracked in vendor/UPSTREAM (chat/jinja
maintained in place; remaining diffs in vendor/patches/)
```
CMake, C++20, hipcc for device code. `RAD_WITH_HIP` (`ON | OFF | AUTO`, default `AUTO`) decides
+41
View File
@@ -1678,6 +1678,47 @@ TEST(a_ring_below_one_decode_step_s_selection_is_raised_to_the_ceiling) {
}
}
TEST(kvstream_fill_clears_garbage_maps_and_ctl_after_elastic_reback) {
/* On park -> restore, the elastic KV pool is discarded and re-backed with uninitialised pages.
* kvstream_fill() must restore every residency/slot entry to -1 and every slot_state and ctl
* word (including overflow latch and cumulative counters) to 0. */
Fixture f;
f.cfg.checkpoint_slots = 0;
f.cfg.max_ctx = 65536;
f.cfg.max_seqs = 2;
f.cfg.vram_kv_mib = 64;
f.cfg.kv_resident = 32768;
std::vector<KVGroupInfo> groups = hybrid_groups();
groups[G_FULL].decl.dtype = RAD_I8;
groups[G_FULL].bytes_per_block = 2048;
const Program prog = stream_program(groups[G_FULL], 512);
CHECK_OK(configure_pools(f.pools, f.cfg));
CHECK_OK(f.kv.plan_groups(groups, f.cfg));
CHECK_OK(kvstream_cap_probe(f.kv, f.cfg, prog, 65536));
CHECK_OK(f.kv.alloc_stream(rad_malloc_allocator(), f.pools.kv()));
CHECK_OK(f.kv.carve(f.pools.kv()));
const KVGroupPlan* p = f.kv.plan(G_FULL);
const KVStreamStore::Map* m = f.kv.stream_map(G_FULL);
CHECK(p && p->streamed() && m && m->res && m->slot_block && m->slot_state && m->ctl);
const int64_t layers = p->n_layers > 0 ? p->n_layers : 1;
/* Poison every map and ctl word with non-zero garbage (simulating uninitialised VRAM). */
std::memset(m->res, 0x5a, (size_t)(layers * p->n_blocks * (int64_t)sizeof(int32_t)));
std::memset(m->slot_block, 0x3c, (size_t)(layers * m->slots * (int64_t)sizeof(int32_t)));
std::memset(m->slot_state, 0x7e, (size_t)(layers * m->slots * 2 * (int64_t)sizeof(int32_t)));
std::memset(m->ctl, 0x42, 16 * sizeof(int32_t));
CHECK_OK(kvstream_fill(f.kv));
for (int64_t i = 0; i < layers * p->n_blocks; ++i) CHECK_EQ(m->res[i], -1);
for (int64_t i = 0; i < layers * m->slots; ++i) CHECK_EQ(m->slot_block[i], -1);
for (int64_t i = 0; i < layers * m->slots * 2; ++i) CHECK_EQ(m->slot_state[i], 0);
for (int i = 0; i < 16; ++i) CHECK_EQ(m->ctl[i], 0);
f.kv.free_stream(rad_malloc_allocator());
}
TEST(a_model_whose_architecture_declares_no_streamed_ops_ignores_the_flag) {
/* An architecture with no streamed path ignores the flag with one line (docs/KV-STREAMING.md
* §4.5): without the resolve the attention would read block ids past the ring, and without the