radiance 1.12.0

New models:
- Fish Audio drama-3: speech with speaker tags and inline direction, voices cloned from reference
  clips (the `references` field of /v1/audio/speech and the streaming session), two cards
- Gemma 4 E2B/E4B (KV-shared layers, per-layer embeddings, clipped vision linears), with
  NVIDIA-Nemotron-3.5-Bolt-E4B in bf16 with DFlash and vision on one card, and E4B recipes

Speed:
- MXFP4 GEMMs for one to 64 rows and a tiled prefill GEMM at TN=4 from 1024 rows: the 27B MXFP4
  with DFlash2 decodes about 1% faster at c1, 5% at c4 and 14% at c16
- The fp8 and int8 LM heads read their weight once for 65 to 128 rows
- A prefill step of one sequence runs in two pieces on a second lane at two ranks (qwen35_fp8,
  gemma3): a 45K-token prompt on the 27B fp8 in 15.1 s instead of 16.2 s
- Gemma 3's fused all-reduce junctions also under a lossy wire
- --draft-short-from N: a block drafter runs its shorter block from N decoding sequences on
  (off by default; with 8 on the 27B MXFP4: c8 +12%, c16 +18%, c64 +32%, c1 unchanged)
- --tp-attn-split rows: GLM-5.3-Flash's MLA attention split by rows over the ranks, 18 to 21%
  faster prefill; lossy, `heads` stays the default
- --draft-coupling on: Qwen3.8-Flash-Next's MTP drafter samples its proposals from its reranked
  top-8 and the target's draw is coupled to it; pays at high temperatures (c1 at T 1.0: 155 ->
  178 tok/s), costs at low ones; off by default

Features:
- Edited prompts on windowed models (Gemma 4) reuse their prefix: periodic window snapshots, and
  snapshot-backed prefix KV kept across recomputes (an edited tail on Gemma 4 31B: 96 s -> 2.6 s)
- DELETE /sessions/<label> and DELETE /sessions?id=<id> forget one stored conversation
- --state-cache-dtype f16: the delta-net state cache at half the memory (qwen35 plugins; lossy)

Fixes:
- A browser's CORS preflight allows DELETE

Changes: Plugin ABI 27: out-of-tree plugins must be rebuilt. The environment switches the PRs
added are flags now (--tp-attn-split, --draft-coupling, --state-cache-dtype).
This commit is contained in:
137 files changed
+12959 -1126

No files matched your search

+231 -39
View File
@@ -17,7 +17,7 @@ plugin claims.
| `arch/glm5next` | `glm5next` | *(empty)* | GLM-5.3-Flash from AMD's Quark MXFP4 export: four mHC residual streams over 34 KDA and 11 sparse latent-attention (MLA) layers with a DSA indexer, 288 MXFP4 experts at top-8 under sigmoid routing, block-FP8 attention and dense layers at f32 scales, each weight served as stored; its MTP layer is a serial drafter. Pictures through its vision tower (`arch/common/rad_block_glm_vision.h`); bf16 KV |
| `arch/lfm2_bf16` | `lfm2` | *(empty)* | LiquidAI's LFM2 and LFM2-VL, bf16, one rank |
| `arch/embgemma2` | `embeddinggemma2` | *(empty)* | EmbeddingGemma 2: a bidirectional encoder with Gemma 4's vision tower and audio conformer, pooled to one vector |
| `arch/gemma4_bf16` | `gemma4` | `compressed-tensors` | Gemma 4 31B dense with its vision tower: sliding-window and proportional-RoPE global (`attention_k_eq_v`) attention, GELU ffn, softcapped logits; int4 codes with an f16 scale per 128 from Google's CT-INT4 (QAT) release or from bf16, served w4a8, or int8 codes on the same grid from bf16 (w8a8, the Q8 container). Optional draft model (`rad-convert --draft-model`): Google's assistant, with no cache of its own (`rad_drafter_shared_kv`), or z-lab's DFlash drafter, the block `arch/gemma4` serves (`arch/common/rad_gemma4_dflash.h`), or RedHatAI's DFlash2 speculator (`arch/common/rad_block_dflash2.h`) |
| `arch/gemma4_bf16` | `gemma4` | `compressed-tensors` | Gemma 4 31B dense, and the E2B/E4B form at one rank, with its vision tower: sliding-window and proportional-RoPE global (`attention_k_eq_v`) attention, GELU ffn, softcapped logits; int4 codes with an f16 scale per 128 from Google's CT-INT4 (QAT) release or from bf16, served w4a8, or int8 codes on the same grid from bf16 (w8a8, the Q8 container). Optional draft model (`rad-convert --draft-model`): Google's assistant, with no cache of its own (`rad_drafter_shared_kv`), or z-lab's DFlash drafter, the block `arch/gemma4` serves (`arch/common/rad_gemma4_dflash.h`), or RedHatAI's DFlash2 speculator (`arch/common/rad_block_dflash2.h`) |
| `arch/gemma3` | `gemma3` | *(empty)* | Gemma 3 dense text (TranslateGemma 27B) from the bf16 checkpoint: sliding-window and global attention at one head geometry, GemmaRMSNorm, GELU ffn; linears bf16, or int8, MXFP4 or asymmetric int4 over an activation scaled per (row, 128), as the recipe stores them. Optional DFlash2 drafter (`rad-convert --draft-model`) |
| `arch/gemma4` | `gemma4` | *(empty)* | Gemma 4 text from Google's bf16 checkpoint (the 26B-A4B MoE and the dense sizes without per-layer embeddings) with z-lab's DFlash drafter; routed experts bf16 or block fp8 |
| `arch/qwenimage21` | `qwenimage21` | *(empty)* | Qwen-Image 2.1 and 2.1-Turbo, an image generator, from the diffusers pipeline directory; DiT and text encoder bf16 or block fp8 |
@@ -29,6 +29,7 @@ plugin claims.
| `arch/qwen3asr_bf16` | `qwen3asr` | *(empty)* | Qwen3-ASR: a Whisper-style audio encoder over a dense Qwen3 decoder, speech to text |
| `arch/minimaxmusic3` | `minimaxmusic3` | *(empty)* | MiniMax-Music3, songs from a description and lyrics: a Qwen3-8B frame model, a depth decoder, a flow-matching DiT and a DAC vocoder, from the diffusers pipeline directory, bf16 |
| `arch/breeze` | `breeze` | *(empty)* | Breeze-TTS-2, speech from text and a description of the voice: a T5Gemma 2 text encoder, a Qwen3 backbone with a 16-codebook depth decoder and the Qwen3-TTS 12 Hz codec, from the release directory, bf16, one card |
| `arch/fishomni` | `fishomni` | `bsgemm-moe` | Fish Audio drama-3, speech from text with speaker tags and inline direction, its voices cloned from reference clips: the Qwen3.5-35B-A3B backbone with its routed experts block fp8 at f32 scales and everything else bf16, a 13-layer codebook tower over the backbone's full-attention cache, and Fish S2's modified DAC, encoder and decoder (`codec.pth`, read as data); from the release directory, two cards |
| `arch/minimaxh3` | `minimaxh3` | *(empty)* | MiniMax-H3, a video with its stereo soundtrack from text: Qwen3-VL-32B's language model as the text encoder, a 33B single-stream diffusion transformer, a tiled ViT video decoder and a BigVGAN audio decoder, from the diffusers pipeline directory; linears block fp8 (`data/recipes/minimax-h3-fp8.recipe`) |
| `arch/ltx2` | `ltx2` | *(empty)* | LTX-2.5 (base and distilled), a video with its stereo soundtrack from text or from text and a first frame: Gemma 4's language model and two text connectors, the duration head, a dual-stream audio-video DiT with four-way guidance, the causal video VAE (tiled past the default canvas) or the diffusion decoder, the audio VAE with a BigVGAN vocoder and bandwidth extension, the x2 latent upsampler; bf16 or block fp8, one card |
@@ -228,7 +229,9 @@ Three groups, which is why hybrid KV groups are first-class:
across the 48 linear layers, and it is what the prefix-cache checkpoint of `spec.md` §7.3
snapshots. Its reads and writes dominate the two GDN kernels. libr4d also compiles an f16 form
(elements are O(0.1); the f16 round trip is about 5e-4 relative) that would halve that traffic,
but the plugins declare f32 because f16 changes the generated text. How a speculative step keeps a
but the plugins declare f32 because f16 changes the generated text; `--state-cache-dtype f16`
declares f16 for a deployment that accepts the loss (GUIDE §4.4: on Qwen3.8-27B MXFP4, mean KL
+0.9..+2.2 %, decode +10 % at sixteen streams without speculation). How a speculative step keeps a
state it can roll back is `docs/OPS.md`'s `state_form`.
## FP8
@@ -447,12 +450,12 @@ the blocks share, places them and issues the step's order.
|---|---|---|
| `rad_block_glm_mhc.h` | `ManifoldConn` | the four-stream residual's read and write |
| `rad_block_glm_kda.h` | `GlmKda`, `KdaState` | the 34 linear layers and their recurrence |
| `rad_block_glm_mla.h` | `GlmMla`, `MlaLatent` | the 11 sparse MLA layers and their absorbed core |
| `rad_block_glm_mla.h` | `GlmMla`, `MlaLatent` | the 11 sparse MLA layers, in the head form or the row form |
| `rad_block_glm_indexer.h` | `GlmIndexer`, `DsaCache` | the DSA indexer, its key cache and selection |
| `rad_block_glm_router.h` | `GlmRouter` | the correction-bias router, through `MoeFP8` |
| `rad_block_glm_mtp.h` | `GlmMtp` | the draft head around the plugin's layer 45 |
| `rad_block_glm_vision.h` | `GlmVision`, `MediaRows` | the tower, and its rows over the embeddings |
| `rad_glm_tp.h` | `GlmTp`, `SplitF32Proj` | the shards, the split threshold, the column split of a replicated f32 projection |
| `rad_glm_tp.h` | `GlmTp`, `SplitF32Proj` | the shards, the one row rule, the split thresholds, the column split of a replicated f32 projection |
```
45 layers, hidden 4096, vocab 154880 (embedding and lm_head separate, bf16)
@@ -548,45 +551,64 @@ at eight ranks each card holds 22.06 GiB of them, 19.67 GiB the routed experts.
layer's latent, index and tail for every row and runs its MoE on the proposal rows only.
**Tensor parallelism.** At 1, 2, 4 or 8 ranks; declare refuses any other. `tests/glm5next_test.cpp`
declares and steps the whole plugin at 1, 4 and 8, against pinned graph and step hashes at 1 and
8, the connection, router and index-gate splits at 1, 2, 4 and 8, the indexer's row split at 2
and 8, the row rule at every world, each issue's operand count against the loaded kernel
libraries' schemas, and every declared weight against the served container's names and encodings.
declares and steps the whole plugin at 1 and 8 against pinned graph and step hashes (the head form,
the row form), the connection, router and index-gate splits at 1, 2, 4 and 8,
the indexer's row split at 2 and 8, the MLA row split at 1, 2, 4 and 8, the row rule at every
world, each issue's operand count against the loaded kernel libraries' schemas, and every declared
weight against the served container's names and encodings.
One row rule (`GlmTp::run_rows`): from a pass of `GlmTp::kSplitRows` = 256 rows, a replicated
piece of work splits by rows over the ranks instead, each rank taking one run of ceil(T / world)
rows rounded up to whole 16-byte words of the row it gathers, because an `all_gather` moves whole
words: multiples of four rows for the indexer's one i32 length a row. The last run may be short;
a rank whose run lies wholly past a small step takes the first run and computes dead rows, so
every plane it gathers is written (`GlmTp::run_of`). The indexer also splits a smaller step, from
16 rows once rows x live blocks reach 2^18 (`GlmTp::kSplitWork`). Below the thresholds, as in
decode, the collective costs more than it saves and every rank runs the replicated form.
One row rule (`GlmTp::run_rows`): from a pass of `GlmTp::kSplitRows` = 256 rows, a replicated or
head-split piece of work splits by rows over the ranks instead, each rank taking one run of
ceil(T / world) rows rounded up to whole 16-byte words of the row it gathers, because an
`all_gather` moves whole words: whole rows for the MLA's 4096-wide bf16 output, multiples of four
rows for the indexer's one i32 length a row. The last run may be short; a rank whose run lies
wholly past a small step takes the first run and computes dead rows, so every plane it gathers is
written (`GlmTp::run_of`). The indexer alone also splits a smaller step, from 16 rows once rows x
live blocks reach 2^18 (`GlmTp::kSplitWork`). Below the thresholds, as in decode, the collective
costs more than it saves and every rank runs the replicated or head-split form.
- The routed and the shared experts split their 2048 width into equal contiguous slices, 256 a
rank at eight; each rank computes its slice of every expert, and the block's all-reduce sums
them. The dense feed-forward splits its 12288 the same way.
- MLA splits by whole heads: the rows of q_b and kv_b (8 heads a rank at eight) and the columns
of o. q_a, kv_a and the latent are replicated.
of o. q_a, kv_a and the latent are replicated. Under `--tp-attn-split rows`
(RadBuildCtx::tp_attn_rows, docs/GUIDE.md §4.7), from the threshold, it splits by rows instead
(`GlmMla::Form::rows`): each rank takes its run under the row rule, the last run shorter,
through q_b, absorption, attention with all 64 heads (`mla_attn_rows_bf16`, docs/OPS.md),
expansion and o, and an `all_gather` of whole runs takes the all-reduce's place. The latent
cache and the DSA selection are whole on every rank, so nothing is exchanged before the
attention. Each rank sends its run to seven peers, half the bytes of the two-shot all-reduce,
and the gather shares that all-reduce's exchange instance. The price is q_b, kv_b and o at full
width on every rank, 120 MiB a layer and 1.29 GiB a card over the 11 trunk layers (the MTP layer
keeps its heads), about 0.1 GiB of activations besides. The head form is the default because
the row form is not bit-identical to it, and this model turns that into a measurable
divergence: against the head form over a 66,657-position corpus of English, German and code at
eight ranks the row form scores a mean KL of 0.038 (median 0.010, p99 0.357, top-1 agreement
91.9 %). The projections are not the cause (q_b and o give the head form's bytes, and o summed
as eight rank partials leaves the KL where it is); the attention's rounding is: the rows kernel
parts from the paired tile in about 0.1 % of every row's outputs by one bf16 step, and the
16-head tile, which parts in the same share of every second row only, halves the KL. On eight
R9700 at Gen5 links the row form prefills a 20k-token prompt at 5,016 tok/s against 4,246 in
the head form (+18 %) and a 64k-token one at 4,975 against 4,117 (+21 %); decode is unchanged.
- KDA splits its 64 heads, with them the q/k/v rows, the convolution taps and the state; the two
rank-128 projections into the gates are replicated.
- The indexer's key side is replicated: every rank keeps the whole index cache and its tail. Its
query side splits by rows from the threshold: each rank scores its run under the row rule,
R = 4 * ceil(T / (4 * ranks)) query rows (`DsaCache::part_rows`), against the whole cache
(`dsa_score` with `row_part`, the last run's rows past the step scoring `-inf`) and selects for
the rows of its run that exist, under the bounds the scorer rebased to the run's first row
(`cu_part`, docs/OPS.md); two `all_gather`s lay the runs' page tables and lengths end to end,
513 and 1 i32 a row, 8 MiB a layer at a 4096-row chunk. The run's queries are all a rank needs,
so the query projection, its quantiser and the head gates run on the run's rows too, and the
gates need no gather; the bf16 projection stays on the step's rows where a run would be 64 rows
or fewer, the skinny band whose split count a tuned configuration may set. Each row's selection
is the same kernels' answer to the same operands, so the joined table is bit-identical to one
rank's and MLA reads it unchanged. The scoring grows with the context (every row scores every
complete block of its sequence), so this is where long prompts gain: the score plane shrinks to
one run (256 MiB to 32 MiB at 64k of context and a 4096-row chunk). A smaller step splits too
from 16 rows once rows x live blocks reach 2^18 (`GlmTp::kSplitWork`): eight sequences
verifying five drafts from about 22k of context, where the scoring of 48 rows outweighs the two
gathers; a single sequence's decode never does, and below both thresholds the indexer runs
whole.
R = 4 * ceil(T / (4 * ranks)) query rows (`DsaCache::part_rows`), against the whole cache (`dsa_score` with `row_part`,
the last run's rows past the step scoring `-inf`) and selects for the rows of its run that exist,
under the bounds the scorer rebased to the run's first row (`cu_part`, docs/OPS.md); two
`all_gather`s lay the runs' page tables and lengths end to end, 513 and 1 i32 a row, 8 MiB a layer
at a 4096-row chunk. The run's queries are all a rank needs, so the query projection, its
quantiser and the head gates run on the run's rows too, and the gates need no gather; the bf16
projection stays on the step's rows where a run would be 64 rows or fewer, the skinny band whose
split count a tuned configuration may set. Each row's selection is the same kernels' answer to
the same operands, so the joined table is bit-identical to one rank's and MLA reads it unchanged.
The scoring grows with the context (every row scores every complete block of its sequence), so
this is where long prompts gain: the score plane shrinks to one run (256 MiB to 32 MiB at 64k of
context and a 4096-row chunk). A smaller step splits too from 16 rows once rows x live blocks
reach 2^18 (`GlmTp::kSplitWork`): eight sequences verifying five drafts from about 22k of
context, where the scoring of 48 rows outweighs the two gathers; a single sequence's decode never
does, and below both thresholds the indexer runs whole.
- The vocabulary is row-sharded, 19360 rows a rank at eight; the embedding's all-reduce is exact.
- The f32 projections (the router's 288 x 4096, the index head gates' 32 x 4096, each
connection's mHC projection of 24 x 16384) are replicated. From a pass of 256 rows
@@ -983,6 +1005,27 @@ chained form right behind the GEMM before the reduction, otherwise it rides the
reads change no value; on 4x R9700 the 31B with DFlash2 decoded 15% faster with them, and without
a drafter about 2%.
**The E2B/E4B form.** `arch/gemma4_bf16` serves Gemma 4's small dense form (tested on
NVIDIA-Nemotron-3.5-Bolt-E4B, `deploy/compose/nemotron-3.5-bolt-e4b-bf16.yaml`) at one rank:
- KV-shared layers: from layer `n_layer - num_kv_shared_layers` on, a layer projects q only and
attends over the cache of the last earlier layer of its class that keeps one (E4B: sliding layers
read 22, full layers 23). Shared layers are not bound to a KV group, so their pages hold nothing.
- Per-layer embeddings (`hidden_size_per_layer_input`): a token table scaled by sqrt(width), plus
the normed projection of the scaled embedding, mixed at 2^-0.5. Each layer runs a branch after
its feed-forward: gate, gelu times its slice, projection, norm, add. On a w4a8 or w8a8 trunk
the junction closes that branch instead of the feed-forward. Image positions read the pad
token's row of the table, as the reference does. The branch is not split across ranks, so a
deployment at more than one rank is refused.
- The global class may keep its own v (`attention_k_eq_v` 0) and leave
`num_global_key_value_heads` null; it then takes `num_key_value_heads`.
- The vision tower's clipped linears (`use_clipped_linears`) clamp each projection's input and
output to the bounds the checkpoint stores (`rad_block_gemma4_vision.h`).
NVIDIA's DFlash drafter states `dflash_config.causal: false`, with every layer sliding; that flag
sets the sliding layers' causality. The recipes are `gemma4-e4b-bf16-df`, `-w8a8-df`, `-w4a8` and
`-w4a8-df`. The bf16 container's KL to HF bf16 is 0.0015 with bf16 KV and 0.014 with fp8 KV, so
the compose file serves bf16 KV.
**FP8 experts.** The experts are ~90% of the weight bytes, so each projection is served as the
container holds it, per layer: bf16 by `moe_gemm`, block fp8 by `moe_gemm_q`. gate_up
`[1408, 2816]` is whole 64-row tiles and 128-blocks. down `[2816, 704]` is not (the fp8 grouped
@@ -1088,15 +1131,23 @@ above), which matters little for translation prompts, whose shared prefix is a l
A linear reading the same activation as the one before it (k and v after q, up after gate) reuses
its codes. On every trunk the q and k norms and both rotaries are one `qkv_norm_rope` at `v_norm` 0.
On an MXFP4 trunk each junction (the branch's post-norm, the residual add, the next norm and the
next linear's E4M3 quantiser) is one `ar_rmsnorm_post_quant_fp8` at two ranks on the exact wire,
the branch's all-reduce in the same launch, or a post-norm and `rmsnorm_quant_fp8` otherwise; a
w4a8 / w8a8 trunk takes `gemma4_bf16`'s fused junctions; an i8a8 or asymmetric-int4 trunk runs the
chain. Where a row is missing the plugin declares the chain, and the startup notes say which form
each took. Under calibration no junction is fused (below).
next linear's E4M3 quantiser) is one `ar_rmsnorm_post_quant_fp8` at two ranks, the branch's
all-reduce in the same launch, or a post-norm and `rmsnorm_quant_fp8` otherwise; a w4a8 / w8a8
trunk takes `gemma4_bf16`'s fused junctions; an i8a8 or asymmetric-int4 trunk runs the chain.
Where a row is missing the plugin declares the chain, and the startup notes say which form each
took. Under calibration no junction is fused (below).
The two fused all-reduce junctions (`ar_rmsnorm_post_quant_fp8`, and `ar_rmsnorm_quant_i8` on a
w4a8 / w8a8 trunk's int8 junction) send the exact wire only, and are byte-identical to
`all_reduce` followed by the chain. Under `--tp-wire wht6` they are declared all the same and taken
per step where the message goes out exact anyway (`ar_wire_is_exact`: a decode step of a few rows,
under `--tp-wire-min-kb`); a wider step keeps the lossy all-reduce, unfused, so a lossy-wire
deployment's decode takes one launch a junction instead of three (all-reduce, post-norm,
junction). A fused step is the unfused exact step bit for bit.
**Pipelined prefill.** At two ranks an MXFP4 trunk with the fused fp8 junctions prefills a prompt
of 1024 tokens or more in two pieces, the junctions and all-reduces of one beside the other's
compute (GUIDE §4.5, `RADIANCE_PREFILL_PIPELINE`). The window KV group's `seqused` counts from its
compute (GUIDE §4.5). The window KV group's `seqused` counts from its
rebased first block, so the first piece's bound is computed on the card (`sub_i32`: the group's
`seqused` less the second piece's rows), not taken from its position. The gain needs 1024-row
pieces: serve at `--max-num-batched-tokens 2048`.
@@ -1608,6 +1659,147 @@ codes. Whisper large-v3 transcribes radiance's speech word for word.
---
# `fishomni`: Fish Audio drama-3, speech
`arch/fishomni` declares an audio generator in its chunked form with one branch a request
(`rad_declare_audio_generator`, `branches` 1, `voc_chunk`): PROMPT runs the backbone over the
whole prompt and the codebook tower over every prompt row, FRAME draws one frame of every speech in
flight and runs the backbone over its embedding, VOCODE plays a lane's newest frames, sixteen at
most. It is served on `/v1/audio/speech` and `/v1/audio/speech/stream` ([GUIDE §5.15](GUIDE.md)),
on two cards. The checkpoint is the release directory; its codec, `codec.pth`, is read with it as
checkpoint tensors under `codec.` (a `torch.save` archive, read as data and never unpickled:
`core/format/torch_zip.h`).
```
backbone Qwen3.5-35B-A3B's language model, unchanged: 40 layers of 2048, three gated delta-net
layers to one gated attention layer (16 q / 2 kv heads of 256, NeoX rotary on 64 dims
at theta 1e7), 256 experts of 512 at top-8 and a gated shared expert of 512, (1 + w)
norms but the delta net's output norm. Only the routed experts are fp8 (E4M3 at an f32
scale a 128 x 128 block, `quant_method: bsgemm-moe`); the rest is bf16. A prompt row is
a token; a frame's row is bf16(bf16(E_lm[248099 + c0] + E_cb[4096 + c1]) / sqrt 2):
code 0 through its semantic token, code 1 through section 1 of the codebook table
head the main token over 4097 candidates only, the end of speech (248046) and the 4096
semantic tokens in id order: the lm_head's rows for them, replicated (the full head is
never declared)
tower 13 layers bound as layers 40..52 of the backbone's full-attention KV group, causal over
the whole sequence at the backbone's positions: 4 shared layers that inject code 0, then
one a codebook, layer k injecting code k - 1 and its head drawing code k (4096 outputs).
A layer is m = eh_proj([enorm(e); hnorm(h)]), a pre-norm block (q, gate, k, v from
wqkv's rows [Q 4096 | G 4096 | K 512 | V 512], (1 + w) q/k norms, GPT-J rotary on 64
dims at 1e7, attention * sigmoid(gate), SwiGLU 6144), a final (1 + w) norm. The first
shared layer also adds the input frame's codes 2..9, embedded and summed in f32
sampling temperature 1.0, top-p 0.9 over the whole candidate set, then the top-k: the main
token uncapped (256) and each head 30, as SGLang-Omni draws; a semantic first draw
among the lane's last 16 picks is redrawn at 1.0 / 0.95 / 30 (`ras_pick`)
codec Fish S2's modified DAC decoder: ten raw codebook rows of 8 (one of 4096, nine of 1024,
codes 1..9 clamped to 1023), each through its own weight-normed 1x1 projection to 1024
and summed; 8 layers of 1024 (16 heads of 64, GPT-J rotary on all 64 at theta 1e4,
causal over 128 frames, plain RMS norms at 1e-5, layer scales); twice a transposed
conv k2 s2 and a ConvNeXt block; a causal conv k7 to 1536; four blocks of snake, a
weight-normed causal transposed conv (8, 8, 4, 2) and three residual units (dilations
1, 3, 9); snake and a conv k7 to one channel, tanh: 2048 samples a frame, 44.1 kHz mono
encoder the codec's, for a reference clip (mono 44.1 kHz, padded to whole frames): a causal
weight-normed conv k7 to 64; four blocks of three residual units (snake, conv k7 at
dilations 1, 3, 9, snake, conv k1) and a snake and a causal conv of kernel two strides
(2, 4, 8, 8), doubling the channels; after the last a 4-layer transformer (window 512
rows); snake, conv k3; twice a causal conv k2 s2 (plain weights) and a ConvNeXt block;
the 8-layer pre-quantiser transformer (window 128 frames); the semantic codebook's
nearest code by cosine, then nine residual steps (`vq_encode`): ten codes a frame
```
The passes, which shift the tower by a row against the reference's loop:
- **PROMPT** runs the backbone over the prompt and leaves its last row's final-norm hidden state in
the lane, then runs the tower over every row, teacher-forced: each row's label is the row after
it, which in a text prompt is text, so every layer's code embedding is zero (the
concatenation's embedding half is filled with zeros once). With references the codec's encoder
first turns the request's clips into frames, written into a code plane at the prompt rows that
name them (`RadAudioGenBatch::ref_frame`); a frame's row is embedded as a made frame's is, a row
before a frame is labelled with it, a frame's row carries its own codes 2..9, and the window of
main picks starts with the prompt's last 16 rows. The last row's tower pass belongs to the first
frame; FRAME 0 writes its cache rows again.
- **FRAME j** draws the main token from the hidden state of the row before the frame's (the
prompt's last for frame 0), runs the tower at THAT row's position, cache slot and context
(`RadAudioGenBatch::prev_slot`, `prev_pos`, `prev_used`) drawing codes 1..9, stores the frame,
and runs the backbone over its embedding at the frame's own row.
Traps (each still speaks, wrongly):
- **The experts' scale planes are f32**, not the bf16 of Qwen3.6-35B-A3B-FP8: the expert format is
read per layer (`MoeFP8::probe`), served as fp8a8f32.
- **The tower's wqkv is blocked, `[Q | G | K | V]`**, not the backbone's per-head `[q_h | gate_h]`
pairs; its rotary is GPT-J's adjacent pairs, not the backbone's halves; its q/k norms run with
`(1 + w)` although its config says `attention_qk_norm: false` (the exporter never wrote it).
- **`eh_proj` reads `[enorm(e); hnorm(h)]`**, the embedding half first.
- **Two masks.** A layer's code embedding is the label frame's, zero when the label is text; the
input frame's codes 2..9 go into the first shared layer only, zero when the input row is text.
The layers that inject code 0 read it by candidate, with the table's row 0 again in front: the
end of speech's code 0 is clamped to 0, as fish-speech clamps it.
- **The tower attends over the whole sequence**, prompt rows included, from 13 caches of its own;
it is not an 11-position depth decoder (`max_seq_len` 11 is left over from S2).
- **The candidates' softmax is over the 4097 only**, top-p over all of them and the top-k cut after
it; a full-vocabulary softmax keeps a different nucleus.
- **The codec's residual codebooks have 1024 entries** and the heads 4096 outputs: codes are clamped
at 1023 at decode (`rvq_embed`'s `clamp`). Its weight norm is per output channel for the convs
and per INPUT channel for the transposed convs (`[in, out, k]`), folded at convert.
- **The encoder's transformer window is 512 rows**, not the 128 frames of the quantiser's: the
window comes from `getattr` on a `functools.partial` config, which has no such attribute, so
fish-speech's default of 512 holds. Both its transformers and the codec's convolutions are
causal, so a clip right-padded to whole frames encodes its frames as the clip alone would.
- **The reference prompt is tokenised a literal at a time**: the instruction's closing `:` and the
first header's `\n\n` are one token when the two are joined. A transcript's speaker tag must
follow `Text: ` directly, so white space before it moves behind it.
- **The input is written as fish-speech's server writes it**: each speaker's turn
`<|speaker:N|> ` and its text stripped, turns joined by a newline, untagged text speaker 0's.
The same two turns joined by a space are spoken through far less often: for one two-line script,
at fish-speech's sampling, one seed in six spoke both lines, against seven in ten with the
newline.
Against fish-speech's own PyTorch code (the CPU path: experts fp8, dequantised per forward, so
W8A16 where radiance runs W8A8), teacher-forced with radiance's codes over a 34-row prompt and 80
frames: the prompt's token ids are identical; the backbone's hidden state is 5.3% from the
reference's (relative L2, median over the frames; cosine at least 0.993), the experts' fp8
activations most of it; the main token's candidate logits 3.6% (KL 0.013 nats a frame, the same
argmax in 92.5% of frames); the nine heads' logits 1.35% (KL 0.007, the same argmax 93% of the time)
over the 79 frames that are spoken. Through the codec, radiance's chunked bf16 decode is 35.4 dB SNR
from the reference's whole-utterance bf16 decode of the same codes. Qwen3-ASR transcribes
radiance's speech word for word.
The encoder against fish-speech's codec encoding the same clip (11.6 s, 250 frames) on the CPU:
radiance's bf16 encoder gives the f32 reference's semantic code in 99.2% of the frames, and its
residual codes in 97.6% (the first) down to 81.2% (the ninth); fish-speech's own bf16 encode gives
95.6% and 94.0% down to 71.2% against the same f32. The reference prompt's token ids are
fish-speech's. Cloning, scored by median F0 and Qwen3-ASR over eight seeds a case, the reference
clips drama-3's own takes of invented sentences: without a reference a sentence's eight takes are
eight voices (116 to 251 Hz); with a reference of a 188 Hz voice they come out at 175 to 210 Hz,
of a 200 Hz voice at 197 to 250 Hz, of a 108 Hz voice at 96 to 122 Hz; two references tagged as
speakers 0 and 1 voice a two-line exchange's turns at 193 to 210 Hz and 109 to 140 Hz. Every take
but one is transcribed word for word (the miss is "I'm" for "I am"). A 12 s clip adds 0.12 s
before a stream's first audio.
The sampling is not fish-speech's server's (temperature 0.7, top-p 0.7, top-k 30 for every draw).
At those the model falls silent after a tag or a speaker's line and does not come back, the failure
vLLM-Omni's recipe and SGLang-Omni's notes describe; SGLang-Omni's comment puts it on the main
token's top-k cap, and the counts bear it out. Ten seeds each of four short scripts (an aside in
`<whisper>`, two two-speaker exchanges, a plain sentence), complete by Qwen3-ASR, and stuck (run to
the 400-frame limit in silence):
| temperature, top-p, top-k (main / heads) | complete | stuck |
|---|---|---|
| 0.7, 0.7, 30 / 30 (fish-speech's server) | 28 / 40 | 8 / 40 |
| 1.0, 0.9, 30 / 30 (Fish Audio's model card) | 35 / 40 | 2 / 40 |
| 1.0, 0.9, 256 / 30 (SGLang-Omni) | 36 / 40 | 0 / 40 |
The four misses at the last setting are a take that ended before the line after the whisper (twice),
a second speaker's single word, and one word the recogniser misheard; the whispered line itself is
spoken in all ten. A take still pauses a second or so around an aside.
On two R9700s a sentence is made at 0.30 of the time it plays (3.67 s of speech in 1.08 s, 13.5 ms
a frame with the codec), a paragraph at 0.29 (11.6 s in 3.34 s); a stream's first audio comes
0.23 s after the request; four paragraphs at once make 50.4 s of speech in 5.15 s.
---
# `minimaxh3`: MiniMax-H3, video with sound
`arch/minimaxh3` declares a video generator (`rad_declare_video_generator`), which makes the
+199 -73
View File
@@ -285,6 +285,7 @@ and runs.
| `qwen3asr_bf16` | Qwen3-ASR, speech to text from the checkpoint as it ships (§5.14) |
| `minimaxmusic3` | MiniMax-Music3, songs from a description and lyrics (§5.15) |
| `breeze` | Breeze-TTS-2, speech from text and an optional description of the voice (§5.15) |
| `fishomni` | Fish Audio drama-3, speech from text with speaker tags and inline direction (§5.15) |
| `minimaxh3` | MiniMax-H3 and FastH3, video with its stereo soundtrack from text (§5.16) |
| `ltx2` | LTX-2.5, video with its stereo soundtrack from text or a first frame (§5.16) |
@@ -461,6 +462,12 @@ rad-convert /srv/models/MiniMaxAI/MiniMax-Music3 -o minimax-music3-bf16.rad \
# bf16 (6 GB, one card)
rad-convert /srv/models/BreezeBlue/Breeze-TTS-2 -o breeze-tts2-bf16.rad \
--recipe data/recipes/breeze-tts2-bf16.recipe
# Fish Audio drama-3, speech (§5.15): the release directory, its codec in codec.pth read with it
# (a torch.save checkpoint read as data, never unpickled); the experts stay block fp8 as shipped,
# the codec is cast to bf16 (39 GB, two cards)
rad-convert /srv/models/fishaudio/drama-3 -o drama3-fp8.rad \
--recipe data/recipes/drama3-fp8.recipe
```
A checkpoint directory's `model.safetensors.index.json` decides which shard each tensor is read
@@ -922,6 +929,36 @@ the pool that holds context; compare M with the sessions you expect to keep live
wht6`, a decode step above the row count startup names is all-reduced lossily like a prefill chunk;
at 8 sequences and depth 3, Flash-Next's decode steps are above it.
**The delta-net state at f16** (`--state-cache-dtype f16`). The `qwen35` plugins (`qwen35_fp8`,
and `qwen35moe_fp8` and `qwen35_w8a8`, built from it) declare the recurrent state cache f32. With
`--state-cache-dtype f16` they declare it f16; startup and the declare log say so (`GDN state cache
f16`), and a plugin that does not serve it is refused at startup by name. **It is lossy**: the
state is rounded wherever it is stored, so the generated text changes. It halves the state pool and
its host checkpoints, and the state's traffic, which grows with the number of decoding sequences.
Measured on `qwen35_fp8` only, Qwen3.8-27B MXFP4 at `--tp 2` on two R9700s (PCIe Gen5 x8, 265 W),
against the bf16 model:
| state | mean KL, 2048 chunk | mean KL, 64 chunk | top-1, 64 chunk |
|---|---|---|---|
| f32, `k6_v4` KV | 0.040238 | 0.039607 | 94.07% |
| f16, `k6_v4` KV | 0.040005 | 0.040468 (+2.2%) | 94.00% |
| f32, `fp8` KV | 0.039171 | 0.039327 | |
| f16, `fp8` KV | 0.039600 (+1.1%) | 0.039690 (+0.9%) | |
A 64-token chunk stores the state, and rounds it, every 64 tokens. Decode, greedy, three rounds
(medians, tok/s):
| streams | f32, no speculation | f16 | f32, speculation 7 | f16 |
|---|---|---|---|---|
| 1 | 67.1 | 67.5 (+0.6%) | 222.2 | 215.1 (-3.2%) |
| 4 | 246.8 | 253.3 (+2.6%) | 636.9 | 621.0 (-2.5%) |
| 16 | 708.0 | 779.5 (+10.1%) | 1223.8 | 1276.7 (+4.3%) |
Without speculation the rounds agree to a tenth and the gain grows with the streams. With
speculation f16 also changes which drafts the greedy text accepts, so one and four streams moved
down; whether that is the text or the step was not separated. Use it for many concurrent sequences
where the KL above is acceptable, and measure your own load.
### 4.5 Prefill chunk size
A long prompt is prefilled in chunks of at most `--max-num-batched-tokens`. On a mixture-of-experts
@@ -1049,61 +1086,37 @@ avoids the extra copies, at the cost of full re-prefill if an edit precedes the
Recurrent-state models still checkpoint at intervals under `tip-only`; their
existing scheduling is unchanged.
**One prefill sequence in two pieces** (`RADIANCE_PREFILL_PIPELINE`). On `qwen35_fp8` (and
`qwen35_w8a8`, built from it, where its norms do not write rotated int8 codes) and on `gemma3`'s MXFP4 trunk, a step of at least 1024 tokens that
carries one prefill sequence and nothing else runs in two pieces of about half, the first rounded up
to 64 rows so both sit in the whole step's kernel band. Every block runs a piece at a time; the work
between two blocks (the block's all-reduce, the next norm, and after a feed-forward the add) runs a
piece at a time on the second lane, beside the other piece's compute. The all-reduce there is the
narrow `overlap` launch ([OPS.md](OPS.md#collectives)): the fused all-reduce and norm holds its
blocks while it waits on the link and slowed the GEMM beside it by a third, and a wide launch slows
it 1.45-2.1x; either ate the whole gain at two ranks. A piece computes what a narrower chunk
computes, so a pipelined step is the serial step bit for bit: Qwen3.8-27B's KL recordings (`k6_v4`,
`--tp-wire wht6`) and TranslateGemma's compare equal with it on and off. One setting makes a piece
differ from the whole step: a lossy `--tp-wire` whose `--tp-wire-min-kb` a piece's message falls
under while the whole step's does not (that piece goes out exact).
**One prefill sequence in two pieces.** At two ranks, on `qwen35_fp8` (and `qwen35_w8a8`, built
from it, where its norms do not write rotated int8 codes) and on `gemma3`'s MXFP4 trunk with the
fused fp8 junctions, a step of at least 1024 tokens that carries one prefill sequence and nothing
else runs in two pieces of about half, the first rounded up to 64 rows so both sit in the whole
step's kernel band. Every block runs a piece at a time; the work between two blocks (the block's
all-reduce, the next norm, and after a feed-forward the add) runs a piece at a time on the second
lane, beside the other piece's compute. The all-reduce there is the narrow `overlap` launch
([OPS.md](OPS.md#collectives)): the fused all-reduce and norm holds its blocks while it waits on
the link and slows the GEMM beside it by a third, and a wide launch slows it 1.45-2.1x. A piece
computes what a narrower chunk computes, so a pipelined step is the serial step bit for bit, with
one exception: a lossy `--tp-wire` whose `--tp-wire-min-kb` a piece's message falls under while the
whole step's does not (that piece goes out exact). Decode steps are unchanged. There is no switch:
the startup log says once that prefill steps are pipelined, and the first wide step that runs
serially says why (`radiance: qwen35: a 2048-row prefill step runs serially: more than one
sequence`).
| `RADIANCE_PREFILL_PIPELINE` | |
|---|---|
| `auto`, or unset | pipelined at two ranks |
| `on` (`1`, `true`) | also at three, four and eight ranks; startup notes that it is not measured there |
| `off` (`0`, `false`) | never |
PIPE_TABLE
Another value is noted at startup and taken as `auto`. On two R9700s (PCIe Gen5 x8, 265 W):
| model, chunk | prompt | serial | pipelined |
|---|---|---|---|
| Qwen3.8-27B MXFP4, 2048 | 41k tokens | 9.00 s | 8.41 s |
| TranslateGemma 27B MXFP4, 2048 | 6k | 1.27 s | 1.21 s |
| | 12k | 2.48 s | 2.42 s |
The Qwen figure includes the tiled GEMM's TN=4 crossover at 1024 rows, which the 1024-row pieces
need. At a 1024-token chunk TranslateGemma's pieces are 512 rows and gain nothing, so serve it at
2048 (against 1024: -9% at 6k, -7% at 12k). Decode steps are unchanged.
- **Above two ranks it is not measured.** `on` lets it run at three, four and eight ranks. At four
libr4d's `overlap` all-reduce rows take a narrow launch that leaves the CUs to compute
([TP4.md](TP4.md)); at three and eight they launch wide unless `R4D_AR_LANE_3_8=1` (§4.7), and a
wide all-reduce beside the other piece's GEMM is what ate the whole gain at two ranks, so try the
pipeline there with the variable set too. Compare a long prompt's prefill with `on` and `off` at
the chunk you serve before keeping it. On the exact wire only the two-shot band above 524288
elements has a lane row: a smaller piece (512 rows of a model 1024 wide) keeps the wide launch,
the one-shot at three and four ranks, the one-shot or the wide two-shot at eight. The
tiered-int8 lane rows at three and four ranks have no such floor. Eight ranks have no
lossy wire, so `on` there pipelines on the exact wire only. Qwen3.8-27B (4 KV heads) and
TranslateGemma (16) do not serve at three ranks.
- **Measured on MXFP4 containers.** `qwen35_w8a8` prefills serially where libr4d serves its
rotated int8 norms (the boundary norms would need the int8 codes on the second lane; startup says
so). Without them it builds the same code, not checked bit for bit on its int8 trunk.
- **Two ranks only.** Other rank counts prefill serially: the pipeline has been timed against the
serial step at two ranks only.
- **Which steps.** A prefill step with more than one sequence, decode rows beside it, or media rows
(an image's tokens) runs serially; the first wide step that does says why, once, on rank 0
(`radiance: qwen35: a 2048-row prefill step runs serially: more than one sequence`). `gemma3`
needs the fused fp8 junctions, a library that serves `sub_i32`, and no calibration tap
(`RADIANCE_CALIB_DIR`); without them a startup note says the pipeline is off.
(an image's tokens) runs serially. `qwen35_w8a8` prefills serially where libr4d serves its
rotated int8 norms (the boundary norms issue E4M3 codes only; startup says so). `gemma3` needs
the fused fp8 junctions, a library that serves `sub_i32`, and no calibration tap
(`RADIANCE_CALIB_DIR`); without them a startup note says the pipeline is off. The pieces need
1024 rows, so the gain needs a chunk of 2048 (the default `--max-num-batched-tokens`).
- **Memory.** The buffers the second lane touches leave the arena's sharing pool across the
architecture's second-lane window ([PLUGIN.md](PLUGIN.md) §11). On Qwen3.8-27B with its DFlash2
drafter at 64 sequences and speculation 7 the activation arena is 526.32 MiB a card, as without
a second lane; the second lane's third hardware queue (33 MiB, §4.3) remains.
architecture's second-lane window ([PLUGIN.md](PLUGIN.md) §11), so the drafter's and the heads'
buffers still share their bytes; the second lane's scratch region holds only what its ops ask
for ([IMPLEMENTATION.md](IMPLEMENTATION.md)). The second lane's hardware queue (33 MiB, §4.3)
remains.
**Sharing a step** (`--busy-prefill-chunk`, default `auto`). When other work is pending, a prefill
chunk leaves room for one row plus the draft window per decode row behind it, and a share of the
@@ -1187,6 +1200,38 @@ behind the packet processor's barrier bit, which saves most of the launch gap be
kernels. The bytes are the same. Plain decode measured slower with them, so they stay off there
and on every other model; the startup report's `chained launches` row says which and why.
**A shorter block under load: `--draft-short-from N`.** A block drafter's block is paid for by
every drafting sequence, whatever each one verifies. At one sequence a long block pays; at many, its
drafter rows and its weaker first positions cost more than the extra drafts bring. A drafter that also
serves a shorter block declares it (PLUGIN.md §11); DFlash2 declares a block of 4 (3 drafts) wherever its
own is longer, on `qwen35_fp8` and `gemma3`. With `--draft-short-from N` the engine runs that short block
once N sequences decoded in the step just run, and the drafter's own block again only once the count
falls two below N, so a load wavering at N does not change the pass shape every step. `0`, the default,
never switches. Startup names what it will run:
```
speculation: from 16 decoding sequences on, 'dflash2' runs its short block of 4 row(s), 3 token(s)
```
or warns that the drafter declares no shorter block, is a serial head, or that none runs. The block driver runs the
short block on the card as it runs the drafter's own: the query pass is the shorter batch, each row's
proposals are the front of the drafter's proposal row, and the step issued ahead verifies that many.
Qwen3.8-27B MXFP4 + DFlash2 on two R9700s, `--num-speculative-tokens 7` at the fixed window, `k6_v4`,
sampled (temperature 1.0), medians of six rounds at 8 streams and three at 16-64, tok/s:
| streams | unset | `--draft-short-from 8` |
|---|---|---|
| 8 | 652.8 | 696.8 |
| 16 | 751.9 | 945.6 |
| 32 | 985.7 | 1070.8 |
| 64 | 1055.0 | 1334.6 |
Below N the engine runs the drafter's own block, the same shapes as with the flag unset (greedy, six
rounds: 1 stream 183.4 and 183.1, 4 streams 529.1 and 537.2). Set it to 8 for a server that decodes
eight or more sequences at once. The drafts are verified as any others; as with
`--num-speculative-tokens`, a different block is a different verify shape, so greedy text can differ at
a near-tie.
### 4.7 Multiple cards
```sh
@@ -1200,6 +1245,14 @@ the exact sum and nothing downstream can detect it, so it is an explicit flag. `
the size below which messages stay exact; 128 KiB keeps single-sequence decode exact and compresses
prefill.
`--tp-attn-split rows` runs a prefill-sized step's attention by rows: each rank takes its run of the
step's rows with every head, and an `all_gather` of the runs replaces the all-reduce. Where the
attention dominates a prefill that is faster, but every card then holds the attention's projections
at full width, and the result is not bit-identical to the default `heads` split. Only a plugin that
declares the row split takes it (GLM-5.3: +18 to 21 % prefill at eight ranks for 1.29 GiB a card, a
mean KL of 0.038 against `heads`, docs/ARCHITECTURES.md); elsewhere, and at `--tp 1`, the flag stops
the start by name.
At three and four ranks `wht6` selects tiered int8 over a two-shot all-reduce, both hops quantised
(at three ranks the shards are whole 32-element groups, one uneven where the message does not
divide), with the same floor. Eight ranks have no lossy wire; `--tp 8 --tp-wire wht6` stops at
@@ -1295,17 +1348,6 @@ engine does not use it: on this board those weights lost their lead within a tim
served no faster. `r4d_selftest --perfar8 --ar8-weights W0,..,W7` times other weights on another
board (`off` for even shards).
**An all-reduce beside compute at three and eight ranks** (`R4D_AR_LANE_3_8`). An all-reduce a
plugin issues on its second lane (`overlap` 1: a pipelined prefill, §4.5; qwen4exp's
`--prefill-span`; gemma4's prefill trunk overlap; the image and video plugins' second-lane
collectives) takes a narrow launch at two and four ranks, measured there: a wide all-reduce's
blocks spin on peer flags on the CUs the GEMM beside it needs, and at two ranks slowed it
1.45-2.1x. At three and eight ranks `ar_twoshot_3rank_exact_lane`, `ar_twoshot_3rank_ti8_lane` and
`ar_twoshot_8rank_exact_lane` take those collectives, but by default they launch exactly as the
wide rows do, so nothing changes against a build without them. With `R4D_AR_LANE_3_8=1` they take
the four-rank launch, 4 blocks of 1024 threads. The bits are the same either way; only the time
moves:
### 4.8 Host tier for finished conversations
By default a finished conversation's KV blocks stay in VRAM, held by the prefix cache, until evicted
@@ -1335,6 +1377,29 @@ whichever tier holds it (VRAM blocks to the pool, host slot to the arena, snapsh
hit or a new turn counts as a use, and a system prompt shared by several conversations stays while
any of them is used.
A client that knows a conversation is dead need not wait for the TTL: `DELETE /sessions/<label>`
forgets it now, with `<label>` the `session_id` (or Anthropic `metadata.user_id`) its requests
carried, or `DELETE /sessions?id=<id>` by the engine id `GET /sessions` lists (`?label=` works for
a label the path cannot carry). `?keep_tokens=N` keeps the first N tokens of the chain, rounded up
to whole blocks, for a client that replaced everything past a prefix (a compaction) and wants the
prefix to keep hitting; on a hybrid model the hit resumes at the last linear-state snapshot inside
the kept prefix (one every `--checkpoint-interval` tokens), so a prefix shorter than the interval
keeps nothing that hits. The chain goes from the tip inwards like expiry, host copy and the
session's snapshots with it; a block another stored conversation also walks (the shared system
prompt) stays, as does one a running request reads. A request of the same conversation in flight
is refused with 409: finish or cancel it first. Like every route but the probes and the page, it
takes `--api-key` when the server has one. The answer says what went and what stayed:
```json
{"label":"chat-7","keep_tokens":0,"sessions":1,"entries":2048,"tokens":32768,
"device_bytes":417792000,"host_bytes":835584000,"snapshots":6,
"kept":{"tokens":0,"shared":64,"live":0}}
```
An unknown label or id is 404; an engine without a prefix cache answers 501. `/sessions` and
`/stats` count what was released under `released`, `/metrics` as
`prefix_cache_released_total{what}`.
```sh
radiance --model m.rad --prefix-cache-mib 8192 --prefix-cache-ttl 3600
```
@@ -1731,6 +1796,7 @@ by 0.002-0.003 nats.
|---|---|---|
| `--gpu-headroom-mib N` | 96 | VRAM left unclaimed on every card |
| `--kv-cache-dtype T` | bf16 | `bf16`, `fp8`, or on Qwen3.8-27B and Qwen3.8-Flash-Next `fp8_v4` or `k6_v4` (§4.4) |
| `--state-cache-dtype T` | f32 | `f32` or `f16`: the recurrent (delta-net) state cache; f16 halves the state memory and is lossy, `qwen35` plugins only (§4.4) |
| `--attn-prefill-fp8 MODE` | off | `off`, `qk`, `pv` or `both`: the prefill attention's Q·Kᵀ, P·V or both in E4M3 over an `fp8`, `fp8_v4` or `k6_v4` cache; lossy, Qwen3.8-27B (§4.4) |
| `--host-pool-mib N` | 0 | pinned host tier (weights) |
| `--host-headroom-mib N` | 4096 | host RAM left free for the system when startup pins host memory — kept for the unpooled allocations, staging and page cache (§4.3) |
@@ -1775,6 +1841,7 @@ by 0.002-0.003 nats.
| `--tp N` | 1 | tensor-parallel ranks |
| `--tp-wire MODE` | exact | `exact` or `wht6`, the lossy wire (§4.7) |
| `--tp-wire-min-kb N` | 128 | smallest all-reduce, in KiB, the lossy wire is used for |
| `--tp-attn-split MODE` | heads | `heads` or `rows`: how a prefill-sized step's attention splits over the ranks, on a plugin that serves the row split (§4.7) |
| `--p2p MODE` | auto | `auto` asks the driver, `on` requires peer access, `off` exchanges through host memory (§4.7) |
**Speculation**
@@ -1783,6 +1850,8 @@ by 0.002-0.003 nats.
|---|---|---|
| `--num-speculative-tokens N` | auto | speculative window; 0 disables. The ceiling under `--draft-window adaptive` |
| `--draft-window MODE` | fixed | `fixed` drafts N every step; `adaptive` follows each sequence's acceptance and the measured step cost, serial draft heads only (§4.6) |
| `--draft-short-from N` | 0 | a block drafter that declares a shorter block runs it from N decoding sequences on, its own block again two below; 0 never (§4.6) |
| `--draft-coupling MODE` | off | `on`: a linear MTP drafter with a 2-bit candidate head (Qwen3.8-Flash-Next) samples each proposal from its reranked top-8 and the sampler maximally couples the target's draw to it. The output distribution is unchanged and a fixed seed yields other tokens than `off`. The head's law is taken at temperature 1, so it pays at high request temperatures and costs at low ones: on Flash-Next TP2 at 2x R9700, tokens per decode step +18% at temperature 1.0 and c1, +11% at 0.7 and c4, -4% at 0.3. Greedy rows are unchanged; any other drafter is refused at startup |
| `--draft-model PATH` | | not implemented: merge the drafter at convert time |
**Server**
@@ -1879,7 +1948,7 @@ flags are refused on it, and so are the pixel bands.
| `POST /v1/systemone` | LiquidAI d1's decisions over a state: named yes/no, choice and score questions answered as probabilities, nothing generated; needs a container converted as d1, else 501 (§5.13) |
| `POST /v1/audio/transcriptions` | OpenAI's speech to text, for a model whose plugin transcribes (Qwen3-ASR), else 501 (§5.14) |
| `GET /v1/realtime` (WebSocket) | OpenAI's realtime transcription session: audio streamed in, the words back as they are spoken (§5.14) |
| `POST /v1/audio/speech` | OpenAI's speech API, whole or streamed: speech from a speech model (Breeze-TTS-2), `instructions` describing the voice; songs from a music model (MiniMax-Music3), `input` the lyrics and `instructions` the song; else 501 (§5.15) |
| `POST /v1/audio/speech` | OpenAI's speech API, whole or streamed: speech from a speech model (Breeze-TTS-2, `instructions` describing the voice; drama-3, speakers and direction in the input); songs from a music model (MiniMax-Music3), `input` the lyrics and `instructions` the song; else 501 (§5.15) |
| `GET /v1/audio/speech/stream` (WebSocket) | vLLM-Omni's realtime speech session: text streamed in, each sentence's audio streamed out as soon as the sentence is complete; needs an audio generation model (§5.15) |
| `POST /v1/videos`, `GET /v1/videos[/:id[/content]]`, `DELETE /v1/videos/:id` | OpenAI's video jobs: a video with its soundtrack from a prompt, made in the background and downloaded as MP4; needs a video model (MiniMax-H3), else 501 (§5.16) |
| `POST /v1/messages`, `POST /v1/messages/count_tokens` | Anthropic's Messages API, for Claude Code and the Anthropic SDKs (§5.9, §5.11) |
@@ -1898,6 +1967,7 @@ flags are refused on it, and so are the pixel bands.
| `POST /tokenize`, `POST /detokenize` | vLLM's shape (`prompt` or `messages` in, `prompt` out) and llama-server's (`content` in and out, `with_pieces`) |
| `GET /get_tokenizer_info` | the tokeniser's configuration |
| `POST /reset_prefix_cache` | drop every cached prefix |
| `DELETE /sessions/<label>`, `DELETE /sessions?id=<id>` | forget one stored conversation (§4.8) |
| `GET /` or `/dashboard` | the web dashboard |
| `GET /stats`, `/graph`, `/sessions` | the JSON the dashboard is drawn from |
@@ -2249,7 +2319,7 @@ passes but not launches (the UNet runs once per image and branch), so two take t
| `stream`, `stream_options.include_usage` | |
| `timings_per_token`, `return_progress` | llama-server's: `timings` on every chunk, and `prompt_progress` chunks while the prompt is read |
| `samplers` | llama-server's sampler order, names or letters. A stage it leaves out is off. The chain here is penalties, DRY, top-k, top-p, min-p, typical, XTC, with temperature first (the default) or last (llama-server's default), so a list in either order is honoured and any other is refused by name |
| `session_id` | OpenRouter's conversation id: labels the conversation on `/sessions` and the dashboard |
| `session_id` | OpenRouter's conversation id: labels the conversation on `/sessions` and the dashboard, and names it for `DELETE /sessions/<label>` (§4.8) |
| `control_vector` | `true` applies the control vector this deployment found to this request's steps, `false` leaves them on the stock model; absent or null takes the deployment's default (`--control-vector on\|off`, or as changed in the dashboard's Model view). A deployment with no vector refuses `true` by name. On a compatible container (Qwen3.8-Flash-Next), a refusal-direction vector makes the model decline far fewer requests -- that is a safety behaviour removed, and you own what it writes (§4.10, "Control vectors") |
| `logprobs`, `top_logprobs`, `n_probs` | each generated token's logprob and up to 20 alternatives (§5.12). Chat: `logprobs: true` with `top_logprobs` alternatives (0 when absent); completions: `logprobs: N`; any endpoint: llama-server's `n_probs: N`, which wins. Not with `echo` (the prompt's logprobs are not computed) |
| `tools`, `tool_choice`, `parallel_tool_calls` | chat only. `tool_choice` is `auto`, `none`, `required` or `{"type":"function","function":{"name":...}}`; the last two hold the whole reply to calls (after the reasoning block), the named form to that one function, and cannot be combined with `response_format` or `grammar` |
@@ -2453,7 +2523,7 @@ each field is read, taken without effect, or refused by name.
| `output_config` | `effort` (`low`, `medium`, `high`, `xhigh`, `max`) is the chat request's `reasoning_effort`, which the template reads in its own level names: a level it does not take is refused with the ones it does, and `--reasoning-effort-map` renames them (§4.9). `format` (`{"type": "json_schema", "schema": ...}`, or the older top-level `output_format`) is a `response_format` (§5.5). `task_budget` is taken |
| `context_management` | validated; the conversation is served as sent, and the answer says so: `"context_management": {"applied_edits": []}`, on `message_delta` in a stream |
| `thread` | `create` is served as any request; `continue` is refused, since no conversation is stored |
| `metadata` | `user_id` is the conversation's label on `/sessions` |
| `metadata` | `user_id` is the conversation's label on `/sessions` and its name for `DELETE /sessions/<label>` (§4.8) |
| `service_tier`, `inference_geo`, `speed`, `cache_control`, `diagnostics`, `safeguards`, `fallbacks`, `context_hint` | taken; none can change the answer here. `cache_control` on a block is dropped too |
| `mcp_servers`, `container` | refused |
| anything else | refused: `"<field>: Extra inputs are not permitted ..."`, Anthropic's own words, which Claude Code matches to retry without a beta field it can drop |
@@ -2685,10 +2755,11 @@ socket.
### 5.15 Speech and music: `/v1/audio/speech`
An audio generation model answers OpenAI's `POST /v1/audio/speech`: a speech model (Breeze-TTS-2)
speaks `input`, in a voice `instructions` may describe; a music model (MiniMax-Music3) sings `input`
as lyrics, as `instructions` describe the song (SGLang-Omni's reading of the route). Both are
converted from their release directories (§3.2).
An audio generation model answers OpenAI's `POST /v1/audio/speech`: a speech model speaks `input`,
in a voice `instructions` may describe (Breeze-TTS-2) or with its speakers and direction written in
the input itself (drama-3); a music model (MiniMax-Music3) sings `input` as lyrics, as
`instructions` describe the song (SGLang-Omni's reading of the route). Each is converted from its
release directory (§3.2).
#### Speech: Breeze-TTS-2
@@ -2717,6 +2788,60 @@ as it is spoken. On one R9700 a sentence is made at 0.6 of the time it plays (5.
speed they play (43 s of speech in 12.1 s). Breeze-TTS-2 is licensed for research and
non-commercial use only, and BreezeBlue counts hosting it as an API as commercial.
#### Speech: drama-3
```sh
radiance --model drama3-fp8.rad --tp 2 # two cards
curl -s http://localhost:8000/v1/audio/speech -H 'Content-Type: application/json' -d '{
"input": "The lighthouse keeper counted seven ships before the fog rolled in."}' -o ships.wav
curl -s http://localhost:8000/v1/audio/speech -H 'Content-Type: application/json' -d '{
"input": "<|speaker:0|> Did you lock the back door?\n<|speaker:1|> [sighs] I thought you did."}' \
-o door.wav # 44.1 kHz mono, 16-bit
curl -s http://localhost:8000/v1/audio/speech -H 'Content-Type: application/json' -d @- \
-o cloned.wav <<EOF # the voice of voice.wav
{"input": "The lighthouse keeper counted seven ships before the fog rolled in.",
"references": [{"audio": "$(base64 -w0 voice.wav)", "text": "What voice.wav says."}]}
EOF
```
- **`input`** is the script. Speakers are named in it, `<|speaker:0|>` to `<|speaker:15|>`, and
text before any tag is speaker 0's; each speaker's turn is written as Fish Audio's server writes
it (the tag, a space, the turn's text stripped, each turn on a line of its own), so the turns may
be given on one line. The direction is written in the text too: point tags such as `[laughs]`,
`[sighs]` or `[pause]`, a bracketed style before a line (`[with bright eager excitement] We
won!`), `<whisper>...</whisper>`. The tokens only the prompt is built from (`<|im_start|>`,
`<|im_end|>`, `<|voice|>`, `<|text|>`, `<|interleave|>`, `<|semantic:...|>`) are refused, and so
is any other spelling of a speaker.
- **`instructions` are refused**, the direction being the input's; `guidance_scale` must be 1 (the
model runs one branch). Without references each speaker's voice is the model's choice, the same
within a take.
- **`references`** clone voices from recordings: an array of `{"audio": ..., "text": ...}`, the
clip a `data:` URL or the base64 of an audio file (anything ffmpeg reads, decoded to mono
44.1 kHz), its text what the clip says; at most 8 clips and 30 s of audio together. A
reference's voice is the speaker its transcript is tagged with, speaker 0 when untagged, so a
dialogue gives each speaker a clip: `"<|speaker:1|> ..."` as the second reference's text voices
the input's `<|speaker:1|>` turns. The clips are encoded by the codec's own encoder in the
request's first pass, in bf16 as fish-speech's server encodes them (a 12 s clip adds about
0.12 s before the first audio), and the prompt is fish-speech's with references:
`[Reference 1]`, its transcript and its frames, for each.
- **The length** is `duration` in seconds or `max_new_tokens` in frames (21.5 a second), up to 95 s;
the model ends the speech at the end of the script. The prompt holds at most 3072 tokens, a
reference adding 21.5 a second of its clip.
- **Sampling** is SGLang-Omni's: temperature 1.0 and top-p 0.9 (Fish Audio's model card), the
first code uncapped and each later code at top-k 30, with fish-speech's repetition-aware redraw
of the first code. fish-speech's server samples at 0.7, 0.7 and 30, where the model often falls
silent after a tag or a speaker's line and runs to its length (docs/ARCHITECTURES.md has the
counts). A take can still end before its last line; another `seed` usually speaks it all.
- **`seed`**, **`response_format`**, **`speed`** and **`voice`** are read as for music below.
Speech is played sixteen frames (0.74 s) at a time as it is made. On two R9700s a sentence is made
at 0.30 of the time it plays (3.67 s of speech in 1.08 s) and a stream's first audio comes 0.23 s
after the request; four paragraphs at once make 50.4 s of speech in 5.15 s. drama-3 is under the
Fish Audio Community License: research, non-commercial and small commercial use are free; a
service that lets others generate speech needs a licence from Fish Audio, and so does imitating a
real person's voice without their consent.
#### Music: MiniMax-Music3
```sh
@@ -2778,7 +2903,8 @@ is complete, so the first audio waits for the first sentence rather than the who
- **`session.config`** takes the fields of `POST /v1/audio/speech` but `input` (`instructions`,
`voice`, `seed`, `guidance_scale`, `max_new_tokens` or `duration` for each sentence, `speed`,
`num_inference_steps` where the model has a denoiser), checked as that route checks them, and
`num_inference_steps` where the model has a denoiser, `references` where it clones a voice),
checked as that route checks them, and
four of its own: `response_format` `pcm` (the default) or `wav`; `stream_audio`, false (the
default) for one binary message a sentence or true for the audio as the model makes it;
`split_granularity`, `sentence` (the default), `clause` (also at commas and semicolons) or `none`
@@ -3109,6 +3235,7 @@ scheduler clamps reuse to the last linear checkpoint. That verdict is the tab's
```sh
curl -s localhost:8000/stats | jq # counters, memory, throughput
curl -s localhost:8000/sessions | jq # what is stored and where
curl -s -X DELETE localhost:8000/sessions/chat-7 | jq # forget one stored conversation (§4.8)
curl -s localhost:8000/graph | jq # the resolved kernel graph
curl -s localhost:8000/server_info | jq # model, cards, KV, draft depth, wire
curl -s localhost:8000/diagnostics | jq # the startup report, hardware read again now (§7.1)
@@ -3157,6 +3284,7 @@ there is none.
| `prefix_hit_cuts_total{reason}`, `prefix_hit_cut_tokens_total` | admissions whose hit reused nothing (`no_snapshot`, `windowed_group`, `adopt_failed`) or resumed at a snapshot more than one checkpoint interval below it (`resumed_below`: the previous reply was longer than an interval, since decode writes no snapshot, the retention policy kept nothing nearer, or a restore was cut), and the checkpoint shortfall: cached prompt tokens computed again because the hit resumed at a snapshot below it. `/stats` and `/sessions` carry the same counts; `RADIANCE_LOG=debug` logs each eviction and each cut hit |
| `prefix_restore_cuts_total` | restores from the host tier the pool could not hold whole, even after giving up other conversations' VRAM copies (§4.8); `RADIANCE_LOG=debug` logs where each was cut |
| `prefix_cache_expired_total`, `prefix_cache_ckpt_expired_total` | what `--prefix-cache-ttl` removed (§4.8) |
| `prefix_cache_released_total{what}` | entries and snapshots clients forgot through `DELETE /sessions` (§4.8) |
| `num_requests_preempted` | |
| `http_queue_depth`, `http_responses_total`, `http_admission_rejected_total` | |
| `client_disconnect_total`, `stream_overflow_total` | |
@@ -3256,7 +3384,7 @@ is the part of a log to paste into an issue. Its sections:
warning is also printed as a `W` line of its own.
```
I STARTUP REPORT -- radiance 1.11.0
I STARTUP REPORT -- radiance 1.12.0
I CONFIGURATION -- every option, the value in force, and where it came from
I --model /models/flashnext.rad [command line]
I --tp 2 [command line]
@@ -3355,8 +3483,6 @@ reductions running on fewer blocks: Qwen3.8-27B's 41k-token prefill 9.5 s uncapp
| `RADIANCE_CALIB_TOKENS` | with `RADIANCE_CALIB_DIR`, the tokens the calibration tap accumulates before it writes and switches itself off (default 65536) |
| `RADIANCE_G3_CALIB_LAYERS` | `lo:hi`: `arch/gemma3`'s calibration tap over layers lo to hi - 1 only, to take a large model's Grams in passes (docs/ARCHITECTURES.md) |
| `RADIANCE_PROFILE_EVERY` | with `--profile-ops`, dump the per-op table every N steps (default 32) |
| `R4D_AR_LANE_3_8` | `1`: at three and eight ranks an all-reduce beside compute (`overlap` 1) takes the narrow four-rank launch instead of the wide one. Same bits; faster where the all-reduce is the shorter of the two, slower where it is the longer; not measured on such machines. Unset or `0`: the wide launch, as without the lane rows (§4.7) |
| `RADIANCE_PREFILL_PIPELINE` | a prefill step of one sequence and 1024 tokens or more in two pieces, the work between blocks of one piece on the second lane beside the other's compute (§4.5): unset or `auto` at two ranks, `on` also at three, four and eight ranks (not measured there), `off` never. The bits are the serial step's |
| `RADIANCE_LOG_STEPS` | log one line per step: its phase, sequences, and each one's token count and context (§4.5) |
Engine development has its own instruments: `RADIANCE_DEBUG_*` (residual probes, routing and issue
+2 -2
View File
@@ -99,8 +99,8 @@ transient buffer counts. `Arena::init` takes both sizes, `arena_plan_bytes` char
budget, and startup prints them (`arena: ... device + ... scratch + ... for the second lane = ...`).
A lane-1 request larger than region 1 comes from an op that breaks rule 3 in its buffers too, so
`Ctx::issue` fails the step naming the kernel (`RAD_E_SCRATCH`) rather than let it overrun the
region. On Qwen3.8-27B with its DFlash2 drafter region 1 is 0 B, where it used to be a copy of region
0: 50 MiB a card at speculation 7, 17 MiB without speculation.
region. On Qwen3.8-27B with its DFlash2 drafter region 1 is 0 B against region 0's 50 MiB a card
at speculation 7 (17 MiB without speculation).
**`rad_memset_async` refuses `RAD_MEM_HOST` on a card; the host backend cannot reproduce that.**
`RAD_MEM_HOST` is pageable memory the GPU has never been shown, so the device backend returns
+73 -12
View File
@@ -1263,14 +1263,16 @@ libref function says which (`libref/ref_audio.cpp`).
| op | params | operands |
|---|---|---|
| `conv1d` | `M`(range) `cin` `cout` `k` `dil` `act`/opt `dtype` `causal`/opt | `x`, `w`w, `cu_seqlens`, `res`? → `y`; `b`w? |
| `conv1d` | `M`(range) `cin` `cout` `k` `dil` `act`/opt `dtype` `causal`/opt `stride`/opt `cu_div`/opt | `x`, `w`w, `cu_seqlens`, `res`? → `y`; `b`w? |
| `conv_t1d` | `M`(range) `cin` `cout` `stride` `dtype` `pad`/opt `k`/opt | `x`, `w`w, `b`w, `cu_seqlens` → `y` |
| `snake` | `M`(range) `n` `dtype` `log`/opt | `x`, `alpha`w → `y`; `beta`w? |
| `snake_aa` | `M`(range) `n` `ratio` `k` `log`/opt `dtype` | `x`, `alpha`w, `beta`w, `f_up`w, `f_down`w, `cu_seqlens` → `y` |
| `cfg_topk_sample` | `M`(range) `n_vocab` `k` `rep` `cond_k`/opt `cfg`:f64 `temp`:f64/opt `stream` `dtype` `sup_lo`/opt `sup_hi`/opt `penalty`:f64/opt | `logits`, `seed`, `frame` → `ids`; `cfg`?, `lane`?, `hist`:inout? |
| `rvq_embed` | `M`(range) `n_embd` `n_codes` `vocab` `off0` `scale`:f64 `dtype` `round`/opt | `codes`, `t0`w, `t1`w → `y` |
| `cfg_topk_sample` | `M`(range) `n_vocab` `k` `rep` `cond_k`/opt `cfg`:f64 `temp`:f64/opt `stream` `dtype` `sup_lo`/opt `sup_hi`/opt `penalty`:f64/opt `top_p`:f64/opt | `logits`, `seed`, `frame` → `ids`; `cfg`?, `lane`?, `hist`:inout? |
| `rvq_embed` | `M`(range) `n_embd` `n_codes` `vocab` `off0` `scale`:f64 `dtype` `round`/opt `clamp`/opt | `codes`, `t0`w, `t1`w → `y` |
| `vq_encode` | `M`(range) `n` `dim` `bins` `dtype` | `x`:inout, `in_w`w, `in_b`w, `cb`w, `out_w`w, `out_b`w → `codes` |
| `frame_mix_store` | `M`(range) `n_embd` `L` `stride` `rep`/opt `dtype` | `hid`, `logits`w, `scale`w, `lane`, `frame`, `status`, `dst`:inout |
| `end_status` | `M`(range) `end` `rep` | `ids`, `lane`, `status`:inout |
| `ras_pick` | `M`(range) `win` `lo` `hi` `rep`/opt `clear`/opt | `first`, `alt`, `lane`, `hist`:inout → `ids` |
| `frame_store` | `M`(range) `n_codes` `stride` `rep`/opt `skip`/opt | `codes`, `lane`, `frame`, `status`, `dst`:inout |
| `resample_nearest` | `M`(range) `n` `dtype` | `x` → `y` |
| `fourier_embed` | `M`(range) `n` `round`/opt `dtype` | `t`, `w`w → `y` |
@@ -1295,14 +1297,34 @@ conditional first, then the unconditional) are consecutive rows, `rep` of them a
`cond_k` > 0 only the entries where `c` reaches its `cond_k`-th largest value are. The `k`
largest `g` (ties to the lower index) are kept, divided by `temp`, softmaxed in f32 and drawn by
inverse CDF in descending `g`, `u = rad_philox_uniform_s(seed, 2^32 + frame, stream)`
(`abi/rad_philox.h`); the pick goes to every one of the lane's `rep` slots. `logits`
`[rep n, n_vocab]` f32 or bf16, `seed` `[n, 2]` u32 low word first, `frame` `[n]`.
(`abi/rad_philox.h`); the pick goes to every one of the lane's `rep` slots. With `top_p` < 1
(Fish Audio's draw) the kept list is cut first: over the softmax of every candidate's `g / temp`
(its normaliser summed in index order), a kept rank whose inclusive cumulative probability in
descending `g` exceeds `top_p` is dropped, rank 0 never, so the nucleus is taken over the whole
distribution and the `k` cut applies after it. `logits` `[rep n, n_vocab]` f32 or bf16, `seed`
`[n, 2]` u32 low word first, `frame` `[n]`.
- `ras_pick`: Fish Audio's repetition-aware sampling, a choice between two draws of each lane:
`ids[rep i] = alt[rep i]` when `first[rep i]` is in `[lo, hi)` and the lane's window holds it,
else `first[rep i]`. The window `hist` `[lanes, win]` i32 is the lane's last `win` picks, oldest
first, -1 empty (`clear` 1 empties it first, for a piece's first pick); the pick then enters it
and the oldest leaves. A pick outside `[lo, hi)` (an end of speech) is never redrawn.
- `end_status`: `status[lane[i]] = ids[rep i] == end ? -1 : ids[rep i]`.
- `rvq_embed`: `codes` is code-major `[n_codes, rows]`, read at the operand's own strides (a block
of a wider plane is a view);
`y = bf16(bf16(t0[c_0 + off0] + bf16(sum_k t1[c_k + (k - 1) vocab])) * scale)`, or with `round` 1
one f32 sum of every codebook's row in codebook order, times `scale`, rounded once to `y`'s dtype.
A first code outside `t0` leaves its row unwritten; a later code outside `t1` adds nothing.
With `clamp` n > 0 a code above `n - 1` reads row `n - 1` (before `off0` and the codebook's
offset; a negative code still reads nothing): a codec whose codebooks are smaller than the heads
that write its codes, as Fish Audio's 1024-entry residual codebooks under 4096-way heads.
- `vq_encode`: one step of a residual vector quantiser with factorised, L2-normalised codes (DAC's,
as Fish Audio's codec encodes a reference): per row of `x` `[rows, n]`, `e = in_w x + in_b`
(`in_w` `[dim, n]`, a 1x1 convolution's weight); the code is the row of `cb` `[bins, dim]` of
greatest cosine with `e`, `(e / max(|e|, 1e-12)) . (cb_c / max(|cb_c|, 1e-12))`, the lower index
on a tie (0 when no score is above -inf), written to `codes[i]` at the operand's own stride; then
`x -= out_w cb[code] + out_b` (`out_w` `[n, dim]`, the raw codebook row), rounded once into `x`.
f32 arithmetic. A chain of these over a codec's codebooks, each quantising what the last left, is
its residual quantiser.
- `frame_store`: `dst[(lane n_codes + k) stride + frame - skip] = codes[k, rep i]` for every `k`,
when `frame >= skip` and `status[lane] >= 0`: a frame's codes into its lane's history, each
codebook a row over the lane's frames, so a run of a lane's frames is a block of `n_codes`
@@ -1345,7 +1367,14 @@ input reads zero outside it.
- `conv1d`: PyTorch's `[cout, cin, k]` weight, `k` odd, dilation `dil` and padding
`dil (k - 1) / 2` a side, or with `causal` 1 (any `k`) `dil (k - 1)` on the left; `res` is added
after the bias, then `act` `none`, `tanh` or `clamp`, `min(max(y, -1), 1)` (BigVGAN's output
clamp; a NaN stays NaN). f32 accumulation, one rounding.
clamp; a NaN stays NaN). f32 accumulation, one rounding. `stride` s > 1 (causal only, the reach
`dil (k - 1) + 1` at least s) pads `dil (k - 1) + 1 - s` on the left and keeps every s-th row:
output row `o` of a sequence reads input rows `o s - pad + t dil`, and sequence `e`'s rows
`[cu[e], cu[e+1])` become `[cu[e] / s, cu[e+1] / s)`, so every bound is a multiple of s; `res`
and `y` have the output's rows (a causal codec encoder's downsampling, as Fish Audio's).
`cu_div` reads the bounds in units that many input rows apart, as the other encoder ops do:
sequence `e` is input rows `[cu[e] / cu_div, cu[e+1] / cu_div)`, each bound a multiple of
`cu_div` times the stride, so one bounds array in samples serves every rate of an encoder.
- `conv_t1d`: PyTorch's `[cin, cout, k]` transposed weight, any `k` of at least a stride (two
strides by default), padding `pad` (`(k - stride) / 2` by default, which needs `k - stride` even;
0 is the causal form, whose full output's last `k - stride` rows are dropped; it may exceed a
@@ -2160,11 +2189,7 @@ start above 524288 elements (8192 at eight ranks), a band edge of the ranged `nu
all-reduce kernel serves `y` absent, in place. `overlap` 1 says the caller issues the collective on
its second lane, beside compute; libr4d then picks rows with a narrow launch (8 blocks of 256
threads at two ranks, 4 of 1024 for the four-rank two-shots, exact and tiered-int8) that compute the
same bits and leave the CUs to the kernels running beside them. At three and eight ranks the lane
rows (exact at both, tiered-int8 at three) launch as the wide rows unless `R4D_AR_LANE_3_8=1` gives
them the four-rank launch, unmeasured there (GUIDE §4.7); the eight-rank one starts above 524288
elements, so an `overlap` 1 message of 8193..524288 elements keeps the wide two-shot there. libref
ignores it.
same bits and leave the CUs to the kernels running beside them. libref ignores it.
libr4d serves these at 2, 3, 4 and 8 ranks:
@@ -2534,6 +2559,29 @@ resolutions of one op. The one exception is `sample_chain` (below).
| `sample_argmax` | `M`(range) `n_vocab` | `logits`, `params` → `token` |
| `sample_merge_topk` | `M`(range) `n_cand` | `gathered`, `params` → `cand_idx`, `cand_val` |
| `sample_logprobs` | `M`(range) `n_vocab` `k` `vocab_off`/opt | `logits`, `params` → `stats` |
| `mtp_couple_propose` | `M`(range) `n_vocab` `round` `max_rounds` | `idx`:inout, `val`, `seq_ids`, `draw` → `state`:inout |
| `mtp_couple_verify` | `M`(range) `n_cand` `n_vocab` | `cand_idx`, `cand_val`, `params`, `state` → `token`:inout |
`mtp_couple_propose` and `mtp_couple_verify` are the linear-MTP coupling (`--draft-coupling on`),
and nothing else in the engine knows about coupling. Turning coupling on requires the
linear serial draft chain: a block drafter (`RAD_DRAFT_BLOCK`) or no drafter at all is refused at
bringup, because neither has a per-round draw to couple. The `spechub` plugin ships both rows and
their host oracle in one library and marks them per row, so the device rows count as production
kernels while the oracle stays reference; on a machine with no card only the oracle is left, and
the gate refuses the coupling there. A `RADIANCE_KERNELS` list is exclusive:
if it is set, it must name `spechub` or the coupled ops are not loaded at all.
`mtp_couple_propose` runs on a draft round's
final reranked top-8 and samples the proposal `x ~ Q`, where `Q` is the FP64 softmax of those
scores at temperature 1; it writes `x` into column 0 of `idx` and one state row per round. A row
whose `seq_ids` does not name the card its draw was staged for, or whose shortlist is malformed,
leaves column 0 alone with `status = -1`. `mtp_couple_verify` runs after `sample_pick`, over the same
final candidate plane, and applies the maximal coupling: the draft is accepted when it equals the
token the target itself drew at that position, and otherwise the token is a draw from the FP64
residual `(P - Q)+`. Both use 53-bit uniforms at `params.pos`; a row whose state is not bound to
that seed and position keeps the ordinary token. `P` is FP64-normalised where `sample_pick` is
FP32/24-bit, so a coupled row realizes the ideal filtered target law and is **not** seed-identical
to the ordinary pick.
`sample_temp` divides a row's logits by its `temp` and leaves a row whose `temp` is 0 or less, or
exactly 1, as it is. The sampler relies on that: a step none of whose chain rows has another
@@ -2887,7 +2935,7 @@ contributes nothing, and a row with no visible key outputs zero. The softmax is
rounded once. `scale` is positive and finite and comes from the original query/key head width,
not the latent width (GLM: `1/sqrt(256)` against a latent of 512).
libr4d has two `mla_attn` rows, both at `latent_dim` 512, `block_size` 4 and up to 64 heads. The
libr4d has three `mla_attn` rows, all at `latent_dim` 512, `block_size` 4 and up to 64 heads. The
matrix row, `mla_attn_matrix_bf16`, ranks above the wave row and takes heads in multiples of 8: the
heads are the WMMA tile's rows, so all of them share each latent load, and the probabilities enter
it as bf16 high and low parts with f32 accumulation. At a multiple of 16 a tile holds 16 heads of
@@ -2899,6 +2947,19 @@ by table position, with a second pass where the two differ. Other head counts ta
workgroups and merge the f32 partials before narrowing, into the fixed scratch their hooks
reserve; without scratch they compute unsplit.
At exactly 64 heads the rows row, `mla_attn_rows_bf16`, ranks above both. A workgroup takes one
query row and all its heads, four waves to each group of sixteen, and loads each 16-token key chunk
once for all of them, where the matrix row loads it once a tile of sixteen. The scores are
`K Q^T`, tokens as the tile's rows and heads as its columns, so a head's running maximum and
denominator stay in its lane; the four waves of a group each take a quarter of the latent's dot
products and add the four partials in one order, and the probabilities reach the value product
through a lane swap instead of LDS. The next chunk's keys are fetched while the current one is
multiplied. A row's output does not depend on the other rows of the batch, so a run of rows gives
the bytes the whole batch would. Under 32 rows (a decode step at one rank) too few workgroups fill the card, and its launcher
runs the matrix row's kernel instead. It also takes multiples of 32 heads (two groups a
workgroup), which no constraint routes to it. GLM-5.3 splits a prefill's MLA by rows under tensor
parallelism, so each rank holds all 64 heads of its rows (ARCHITECTURES.md, `glm5next`).
`mla_project` moves a query into the latent and a latent result out of it, through the bf16
weight `b` `[heads*2*head_dim, latent_dim]` that stores each head's key rows, then its value rows.
`mode=absorb` multiplies `a` `[M, heads, head_dim]` by the head's key block as stored,
+15 -6
View File
@@ -57,6 +57,7 @@ Five more exports are optional, each looked up by exactly this name:
| `int rad_kernel_concurrent(int i)` | nonzero: kernel `i` touches nothing but its operands and scratch, so independent launches may overlap |
| `int rad_kernel_collective(int i)` | nonzero: kernel `i` exchanges data with the other ranks' cards, so the engine keeps its own bulk link traffic away while it runs. 2: each launch ends that hold itself once the other ranks' bytes have landed, through the `link_gate` parameter (`rad_abi.h`). Without this export only the `all_reduce` op is a collective |
| `int rad_plugin_reference(void)` | nonzero: a **reference implementation**, ranked below every unnamed library, refused for serving unless `--debug-accept-reference-kernels`, and what `rad-kbench` checks the others against. libref declares itself this way |
| `int rad_kernel_reference(int i)` | per row: nonzero marks kernel `i` as a reference implementation and 0 as a production one, overriding `rad_plugin_reference` for that library. For a plugin that ships a device row and its host oracle side by side (`plugin/spechub`) |
---
@@ -371,8 +372,8 @@ says so with `RAD_ARCH_SERVES_IMPORTS(0)` (`qwen35_w8a8` does), and imports keep
outside the window (a drafter's, the heads') share its bytes again. What the plugin promises:
it issues nothing on lane 1 outside the window. What the runtime does (`Ctx::issue`): an op
issued on lane 1 outside the window fails the step, naming the window's op range and the op's
position; the first op issued on lane 0 past the window joins lane 1 first when lane 1 has work
pending, so the plugin need not join before the window ends; an op the core appends behind a
position; an op issued on lane 0 outside the window, before or past it, joins lane 1 first when
lane 1 has work pending, so the plugin need not join before the window ends; an op the core appends behind a
declared one (runtime LoRA) counts at that op's position. The builder refuses a second `begin`,
an `end` without a `begin`, twice or around no op, a `begin` never closed, and either call after
declare. `qwen35_fp8` (with the plugins built from it) and `gemma3` declare one from the
@@ -382,10 +383,18 @@ says so with `RAD_ARCH_SERVES_IMPORTS(0)` (`qwen35_w8a8` does), and imports keep
([IMPLEMENTATION.md](IMPLEMENTATION.md)) the KV pool from 86 208 to 93 856 tokens.
`tests/arch_test.cpp`'s builder applies the window to liveness as the core does, so the pinned
graphs and steps are the ones the core plans; the runtime (`Ctx::issue`) is what refuses a lane-1
op outside the window. The join is at the window's end only: an op declared before the window must
not be issued again while lane 1 has work pending. Both calls are additive exports:
`RAD_ABI_VERSION` (26) does not move, and a plugin that does not call them is unaffected. A plugin that calls them needs an engine that exports them; an older engine fails
to load it (`dlopen` with `RTLD_NOW`: an undefined symbol).
op outside the window. Both calls are ABI 27 exports; a plugin that does not call them is
unaffected.
- **A block drafter may serve a shorter block.** `rad_drafter_short_block(b, block)`, called once
after `rad_declare_drafter`, says the plugin declared its query pass at `block` rows a sequence as
well as at `RadDrafterDecl::block`, with the same anchor convention, so the core may stage a step
at either; the short block proposes `block - (RadDrafterDecl::block - depth)` tokens. The builder
refuses it without a block drafter, at or above the drafter's own block, and where it would
propose nothing. The engine runs it under `--draft-short-from` (GUIDE §4.6) and reads row `s` of
the proposals at `s * proposal_pitch`; a block drafter's `proposal_pitch` defaults to its
depth (a row holds the whole block's proposals and a short block fills its front) and is refused
below it. The pass's block is `n_tok / n_seq`; a block the plugin has no ops for should fail the
step (`rad_block_dflash2.h` does). Appended in ABI 27.
- **Media preprocessing is the core's** (`core/mm`): resizing, patching, placeholder-token
expansion and positions, in five processor families (Qwen-VL, Gemma 4, LFM2-VL, Unlimited-OCR,
GLM-5.3) chosen by the container's `vision_config.model_type` (Unlimited-OCR's by its
-15
View File
@@ -137,21 +137,6 @@ fold in fp32 in ascending rank order, so the switch between them changes no bits
at three ranks is the tiered-int8 wire over the same uneven two-shot for messages from
`--tp-wire-min-kb` up, and the exact one-shot below.
An all-reduce a plugin issues on its second lane beside compute (`overlap` 1, [OPS.md](OPS.md)
Collectives) takes `ar_twoshot_3rank_exact_lane` or `ar_twoshot_3rank_ti8_lane`, the exact and
tiered-int8 two-shots' entry points one priority above the wide rows: qwen4exp's pipelined prefill
under `--prefill-span` ([GUIDE.md](GUIDE.md) §4.5), gemma4's prefill trunk overlap and the image and
video plugins' second-lane collectives among them. By default they launch exactly as the wide rows
(`tArTs38Lane` holds `tAr`'s defaults), so a three-rank deployment runs as it did before them.
`R4D_AR_LANE_3_8=1` gives them the four-rank lane rows' launch, 4 blocks of 1024 threads; the
arithmetic is the wide rows' either way, bit for bit. At two ranks a wide all-reduce beside a GEMM
slowed it 1.45-2.1x on R9700s, which the narrow launch avoids; at three it may pay the same way,
or cost where the all-reduce outlasts the compute beside it. Not measured: no three-card machine
was available, and the launch is untuned there. GUIDE §4.7 has how to compare the two.
`RADIANCE_PREFILL_PIPELINE=on` also allows `qwen35_fp8`'s and `gemma3`'s pipelined prefill at three
ranks, but neither model this tree serves with them splits its KV heads three ways (Qwen3.8-27B has
4, TranslateGemma 16), so it has nothing to run there yet.
Startup logs the geometry:
```
+3 -7
View File
@@ -75,13 +75,9 @@ promotion truth; quick concurrency ladders within windows.
5. Draft-pass graph capture — only if low-concurrency latency ever matters.
6. **The dense pipelined prefill at TP4** (`qwen35_fp8`, `qwen35_w8a8`, `gemma3`; GUIDE §4.5): a
prefill step of one sequence in two pieces, every block boundary's all-reduce on the second lane
at `overlap` 1, so on this table's `*_4rank_*_lane` rows (row 1). Off by default above two
ranks; `RADIANCE_PREFILL_PIPELINE=on` allows it and startup notes that it is unmeasured. Measured
only at TP2 (2×R9700, PCIe Gen5 x8, 265 W): Qwen3.8-27B MXFP4 41k prefill 9.00 → 8.41 s,
TranslateGemma 27B 6k 1.27 → 1.21 s at a 2048 chunk; bit for bit the serial step by construction,
checked by KL recordings at TP2 (arch_test checks the pieces and lanes a four- and an eight-rank
step declares, not their output). One boot-flag arm, `on` against `off`, at 18K-64K
prompts and the chunk served, settles whether it ships on by default here.
at `overlap` 1, which at four ranks would take this table's `*_4rank_*_lane` rows (row 1). It
runs at two ranks only; enabling it here (`g.world == 2` in both plugins' declare) needs a
timing against the serial step at 18K-64K prompts and the chunk served.
## Interaction diagram