Independent review of fa118d8 / 14fb72c: no defect. Notes taken:
- RADIANCE_PREFILL_PIPELINE takes 1 / true as on and 0 / false as off (the old per-arch switches
took 0 for off; such a value must not leave the pipeline on); the header says that past two
ranks only the two-shot band is narrow and that eight ranks pipeline on the exact wire only; the
note says the switch allows the pipeline (gemma3 may still turn it off); "rad_arch.h" as the other
common headers include it; comment lines rewrapped.
- plugin_test resolves the all-reduce at `overlap` 1 against the real libr4d: the two-shot band
takes the lane row at three, four and eight ranks, exact and ti8; the one-shot band keeps the wide
row. arch_test: every spelling of the switch, off at two ranks in all three; no three-rank arch
case (neither test model's heads split three ways, nor do the real models' KV heads).
- r4d_selftest: gemv_wide's two column tiles at four row tiles and on the per-row scale.
- r4d_selftest: every timed pass is preceded by an untimed one. A fresh process otherwise times its
first pass while the clocks ramp up from idle (up to 1.5x slow, +-30 % between runs); two builds
of the same machine code read 13 % apart until both warmed.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
- One switch for qwen35_fp8's and gemma3's pipelined prefill, RADIANCE_PREFILL_PIPELINE=auto|on|off
(arch/common/rad_prefill_pipe.h), in place of RADIANCE_QWEN35_PIPE / RADIANCE_GEMMA3_PIPE. auto
(or unset) pipelines at two ranks, where it is measured; on also at three, four and eight, with a
declare note that it is not yet measured on such hardware; off never. Another value is noted and
taken as auto.
- libr4d: the narrow `overlap` all-reduce rows at three and eight ranks, as the four-rank ones are:
the wide two-shot rows' entry points (exact at three and eight, ti8 at three) at tArTs4Lane's
launch, so the collective beside the other piece's compute does not take the card (a wide one
slows the GEMM beside it 1.45-2.1x and ate the whole gain at two). Bit-identical to the wide rows
by construction; neither launch is tuned on three or eight cards, which this rig does not have.
arch_test: at four and eight ranks a 2048-row step of one sequence is serial unless asked; asked,
it runs in two pieces on every rank with every collective on the second lane at `overlap` 1 and
the embedding's whole (failed before the change: the step stayed serial).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The pipeline is decided before the blocks are declared, the fused fp8 junctions only after them.
Where those then did not resolve (no rmsnorm_quant_fp8, a mixed container), every q|k|v and
gate|up still read the shared pair as a shared linear with no quantiser, and the serial fallback
read whatever the last writer left there. The pair is now handed to each such linear as the
target of its own quantiser (G3Linear::q8_into / s8_into): the fused junctions write it when they
resolve, the unfused step's quantisers otherwise.
- a note says why the pipeline is off when declare turns it off;
- a missing bounds buffer fails the step on both ranks (rad_step_fail) instead of one rank
falling back to the serial step alone.
arch_test: with rmsnorm_quant_fp8 refused at two ranks and 2048 rows the step is serial, every
q and gate|up quantises into the pair it reads (failed before: no quantiser).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
qwen35_fp8's pipelined prefill on Gemma 3's MXFP4 trunk at two ranks: every block runs a piece
at a time on lane 0 (the attention over its own query bounds and positions, the GeGLU MLP), and the
work between two blocks a piece at a time on lane 1 -- the block's all-reduce at `overlap` 1, its
post-norm and the fp8 junction (the add and the next norm with its quantiser), after the last block
the add, the DFlash2 taps and the final norm. RADIANCE_GEMMA3_PIPE=0 turns it off.
- Every q|k|v and gate|up reads one shared E4M3 input pair under the pipeline (the junctions write
it), so the second lane's buffers cost one pair, not one a linear (rad_buf_concurrent keeps them
live for the whole program).
- A window KV group's seqused counts from its rebased first block, so the first piece's cannot be
its position: it is the group's seqused less the second piece's rows, computed on the card by a
new libr4d op, sub_i32 (y = x - s[0], int32; documented in OPS.md, a selftest case). The first
try used the position and faulted on a 12k prompt past the 1024-token window.
- G3Linear and G3JunctionFP8 row-sliced forms; each block's overlap all-reduce.
Bit for bit the serial step: TranslateGemma's KL recordings at chunk 2048 and one sequence a step
(so a document's steps from 1024 rows pipeline) compare equal with the pipeline on and off. Prefill
on two R9700s, chunk 2048: 6k tokens 1.27 -> 1.21 s, 12k 2.48 -> 2.42 s; at chunk 1024 (pieces of
512) no gain, so a deployment wants 2048 (against 1024: -9 % / -7 %). arch_test: a 2048-row TP2
step runs in pieces with its collectives on lane 1 and the shared pair; RADIANCE_GEMMA3_PIPE=0 runs
it serially.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
At two ranks a prefill step of at least 1024 rows is cut into two pieces of about half
(pipe_rows: rounded up to 64, both in the whole step's band). Every block runs a piece at a
time on lane 0; the work between two blocks runs a piece at a time on lane 1: the block's
all-reduce at `overlap` 1 (the narrow lane rows), then the next block's plain norm, and after
a feed-forward that keeps its add, the add, the DFlash2 taps and the final norm. The fused
all-reduce + norm is not used there: it holds its blocks while waiting on the link and slowed
the GEMM beside it by a third (measured: no gain at all with it).
- GdnFP8, AttnGatedFP8: takes_pieces(); the dense attention gets a two-piece path (each piece
its own rows, positions, slots and query bounds, seeing the cache up to its own end), and
the delta net's piece path takes the caller's normed input (ArPieces::in_ready) and passes
each piece its own context length (positions + r0), so a prompt's first chunk works.
- MlpFP8: slice() split into body() and tail(), and an overlap all-reduce (issue_ar).
- NormQuantFP8::step_plain().
- M-RoPE batches (the vision tower loaded) take it when no token's components differ: plane 0
of rope_pos is then every token's position.
- RADIANCE_QWEN35_PIPE=0 turns it off; a wide prefill step that runs serially says why, once.
Bit for bit the serial step: Qwen3.8-27B KL recordings (k6_v4, wht6) compare equal with the
pipeline on and off, and greedy answers to three long requests (680-41k tokens, speculation 3
with the DFlash2 taps) are identical. 41k-token prefill on two R9700s: 9.00 -> 8.41 s with the
TN crossover of the next commit (-6.6 %). arch_test: the two-rank pin moves; new tests pin the
serial build under RADIANCE_QWEN35_PIPE=0 and the pieces, lanes and overlap of a wide step.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
New models:
- GLM-5.3-Flash reads pictures: its vision tower and processor (--image-tokens sets the budget),
with decode kernels for a few rows and the DSA indexer split over the ranks
- Sage-A1.5 (fp8 and MXFP4) with its vision tower and a DFlash2 drafter
- Unlimited-OCR (bf16)
- Gemma 4 31B with z-lab's DFlash and RedHatAI's DFlash2 drafters; at four cards its all-reduces
are fused with the junctions, overlapped with the compute and sent compressed
- Ornith-1.5-35B-A3B w4a8 compose files
Speed:
- Block drafters (DFlash, DFlash2) accept their drafts on the card, and the next step is issued
ahead
- The four-rank all-reduce is faster for every --tp 4 model
- qwen35_w8a8: the norms and SiLU write the int8 linears' operands directly
- --attn-prefill-fp8 off|qk|pv|both: fp8 QK and PV legs for the h256 prefill attention (about +20%
prefill on a 221K-token prompt for the 27B MXFP4 at TP2); lossy, off by default
Features:
- Control vectors: --control-vector off|on|disabled (disabled by default), a per-request switch,
and the published Qwen3.8-Flash-Next refusal-direction vector (its license is in NOTICE)
- Krea 2: the `rebalance` request field, as ComfyUI's ConditioningKrea2Rebalance
- Cards with a small PCI BAR run, with kernel arguments kept in host memory
- Dashboard: live acceptance figures; statsdump rotates its file at a size cap
- KV caches every rank holds whole (GLM-5.3's latent and index caches) take one host-tier slot
Fixes:
- Long conversations taking turns no longer fall back to an early snapshot: a host-tier restore
makes room as memory pressure does and waits a step for the previous turn's release (two
conversations of 142K and 147K tokens sent back to back: 31.3 s per turn before, 2.8 s now)
- Kernels before Linux 6.16 (amdgpu below 3.64) no longer hang at startup: virtual memory
management is turned off there, with a warning
- Gemma 4 dense scales its token embeddings as Hugging Face does (bf16), which changes its output
- The four-rank all-reduce fences prefill-sized messages, for a rare divergence after a fresh start
- GLM-5.3: every refusal names the setting and the reason; its template keeps string content
- Several pictures in one request no longer refuse processors that take one image at a time
Changes: Plugin ABI 26: out-of-tree plugins must be rebuilt. The environment switches the PRs
added are fixed rules or flags now (R4D_ATTN_FP8 is --attn-prefill-fp8).
Sage-A1.5 (InternScience) is Qwen3.5-MoE's routed trunk with the Qwen3.5 vision tower beside it -- a shape qwen35moe_fp8 already declares, but no fixture covered the two together: the MoE fixture had no tower, the VL fixture was dense. arch_test gains q35moe_vl_meta, and checks the tower declares once for the build (not a copy a rank), that it is withheld when no encoder budget is given, and that the routed blocks, the folded shared expert and the MTP layer's own router are still declared beside it.
sage-a1.5-fp8.recipe puts every trunk linear -- attention, the delta net's in- and out-projections, the routed and shared experts of all 40 blocks, and the MTP layer at index 40 -- into block fp8, the head likewise, and keeps the routers, the shared-expert gates, the delta net's parameters, the norms, the embedding and the whole vision tower as the checkpoint ships them. recipe_test reads the shipped file and asserts all of that.
sage-a1.5-fp8-df2.recipe is the same trunk with incoai/Qwen3.6-35B-A3B-DFlash2's tensors in place of the MTP head, which the shared source declares through declare_dflash2. On two R9700s it decodes 392.9 tok/s against 281.6 with the MTP head, at 49.3% acceptance and depth 7; on one card, 231.6 against 168.3.
Compose: sage-a1.5.yaml (two cards, four 32k sessions), sage-a1.5-tp1.yaml (one card, an 8 GiB pinned host pool, one 262,144-token session) and sage-a1.5-df2.yaml. README, DOCKER.md and ARCHITECTURES.md list the containers and the drafter.
The prefill overlap's lane all-reduces coded losslessly at ~12.2 bits a value; the verify step's
GEMM, norm and all-reduces tuned for 17-64 rows; at 4-16 rows each GPU norms its own rows between
a reduce-scatter and an int8 all-gather; deploy/compose/gemma4-31b-w4a8-df2-tp4.yaml.
Squashed from:
- libr4d: the four-rank exact two-shot coded at ~12.2 bits a bf16 value, for the lane row
- libr4d: the prefill overlap's lane all-reduces coded by default
- libr4d: decode-sized two-shots take fewer blocks
- libr4d: gemm_w4a8_nt_m64 at multi-user verify heights (33-64 rows) -- narrower row tiles, wider N
- libr4d: rmsnorm_quant_i8's register form at 512 threads too (33 to 72-120 rows)
- libr4d: ar_rmsnorm_quant_i8_4rank's `sp`, the all-reduce split around the junction
- arch/gemma4_bf16: the 31B's junctions take libr4d's `sp` at 4-16 rows at four ranks
- deploy/compose, README: Gemma 4 31B with RedHatAI's DFlash2 drafter on four cards
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Chained launches on the AQL backend (a dependent kernel waits on a queue counter in its own
prologue), on by default where the model's plugin measured a gain with its block drafter (the
Gemma 4 31B and 26B); the prefill overlap runs attention per slice with narrower lane-1
reductions; the next GEMM's weight is read into the on-die cache beside each all-reduce at decode
heights.
Squashed from:
- core, libr4d: chained launches -- dependent kernels wait in their prologue, not behind the barrier bit
- core, libr4d: chain a kernel by its name, not by the row that launched it
- libr4d, core: chained forms hold nothing across their body
- libr4d: a chained kernel's prologue polls its counter less often after the first few tries
- core/sched: the advance kernel's chained form
- docs: GUIDE lists RADIANCE_CHAIN; chained launches stay opt-in
- core/device: a chained packet behind a chained one keeps its barrier bit while a plain one may run
- libr4d: qkv_norm_rope and its kv_store fold as chained forms
- libr4d: the split-KV decode attention and its merge as chained forms
- libr4d: the four-rank fused junction's tail form as a chained form
- libr4d: the attention, prologue and junction chained forms hold nothing across their body
- libr4d: the 31B's windowed attention and quant_act_i8 as chained forms; r4d_chain.h stubs for the host emulator
- libr4d: DFlash2's kernels as chained forms
- libr4d: chained forms for the decode tail
- abi, core, arch: chained launches on by default where the plugin measured a gain with its drafter
- arch/gemma4_bf16: the prefill overlap's lane-1 all-reduces take the narrow launch (`overlap` 1)
- arch/gemma4_bf16, libr4d: the prefill overlap runs attention per slice; kv_len_trim
- abi, core, libr4d: RAD_LAYOUT_ANY, and a device-only weight read (prefetch)
- arch: read the next GEMM's weight into the cache beside each collective at decode heights
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Attention reads q and the gqa-8 drafter's KV in place (attn_paged_qrow); the 31B's attention
prologue stores k and v itself (qkv_norm_rope_kv_store); DFlash2's norm/rope/cache-store chains
and add-then-norm pairs run as one launch each. Carries the launch-cliff padding until that PR
merges.
Squashed from:
- libr4d: attn_paged_qrow on the split-KV decode kernel -- h256/gqa2, and h128/gqa8 by two groups a kv head
- arch: the 31B's sliding layers and its drafter read through attn_paged_qrow where a card serves it
- libr4d: step past the full-card launch cliff in qkv_norm_rope and the row norms
- libr4d: qkv_norm_rope describes its operands, so rad-kbench and rad-tune can time it
- libr4d, arch/gemma4_bf16: qkv_norm_rope_kv_store -- the 31B's prologue stores k and v itself
- libr4d, arch/common: qkv_norm_rope takes v_norm; DFlash2's query pass folds its q/k chain
- libr4d, arch/common: qkv_norm_rope takes n_head 0; DFlash2's context pass folds its key chain
- libr4d, arch/common: add_rmsnorm; DFlash2 issues each residual add with the norm after it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The 31B's prefill steps of 1024 rows or more run as two slices with each slice's all-reduces
beside the other's compute; q, k and v as one linear where the container holds them so; the 31B
serves RedHatAI's DFlash2 speculator; DFlash2's fc projection is split over the ranks, bit for bit.
Squashed from:
- arch/gemma4_bf16: a prefill step in two slices, each slice's reductions on the second lane
- arch/gemma4_bf16: q, k and v as one linear where the container holds them so
- data/recipes: the 31B -df recipes make q, k and v one linear (blk.*.attn_qkv)
- arch/gemma4: the 31B serves RedHatAI's DFlash2 speculator (gemma-4-31B-it-speculator.dflash2)
- libr4d: gemm_nt_q takes split_n, and all_gather lands rows at a wider output pitch
- arch/common: DFlash2's fc split over the ranks as windows of block-aligned rows, bit for bit
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Gemma 4's DFlash drafter moves into arch/common so both Gemma 4 plugins declare it, on the int8
grid too; the 31B declares it beside its w4a8 / w8a8 trunk when the container carries one; the
w4a8 and Q8 -df recipes and compose files; the tests.
Squashed from:
- arch: Gemma 4's DFlash drafter into arch/common, for both Gemma 4 plugins, and on the int8 grid
- arch: z-lab's DFlash drafter beside the 31B's w4a8 / w8a8 trunk, its gqa-8 attention at gqa 4
- data/recipes: gemma4-31b with DFlash, the w4a8 trunk with a block-fp8 drafter, and Q8
- tests: the 31B with its DFlash drafter declares the chains where libr4d's fused ops are not declared
- tests: the 31B's steps with its DFlash drafter lint clean, on both grids, at one, two and four ranks
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The four-rank exact all-reduce picks its transport and block count by message size, for every
tp-4 model; the four-rank fused junction gains its tail form (the two-shot with the junction after
it), which the 31B takes up to 16 rows. Carries rmsnorm_quant_i8's register form until that PR
merges.
Squashed from:
- libr4d: the four-rank all-reduce's fold a word at a time, 16-row standalone all-reduces on the two-shot, counters in L2
- libr4d: the standalone four-rank all-reduce takes the exact two-shot from 32768 elements
- libr4d: the four-rank exact all-reduce's two-shot takes 2 blocks at a DFlash2 verify, not 4
- libr4d: the all-reduce rows' nblocks axis offers 2 and 4
- libr4d: rmsnorm_quant_i8 at decode heights loads the row's operands before its reductions
- libr4d: the four-rank fused junction's tail form -- the two-shot with the junction after it
- arch/gemma4_bf16: the four-rank fold up to 16 rows, on libr4d's tail form
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The plugin carried the draft head's buffers, weights and ops in its declare and its draft pass
in its step, with the three ops that join the head to its layer declared inside the layer
function; each GLM block carried its core in a header of its own (rad_block_mla_latent.h,
rad_block_kda_state.h, rad_block_dsa_cache.h), the split threshold sat in rad_tp_split.h beside
the router's column split, and 64 / world, 8192 / world, 2048 / world were spelled across the
plugin and the blocks. tests/arch_test.cpp held the recording builder, the run-phase fakes, the
step lint, the batch kits and the fingerprints beside every architecture's cases, 9.5k lines in
one translation unit, GLM-5.3's among them.
Now one block a file in arch/common: rad_block_glm_{mhc,kda,mla,indexer,router,mtp}.h, the
cores joined to their blocks, and GlmMtp the draft head in three parts (inputs, join, head),
declared and stepped around the plugin's layer 45. rad_glm_tp.h (GlmTp) holds the widths a
rank's shard divides, the one threshold kSplitRows and the replicated all_reduce declared once;
SplitF32Proj moves over unchanged. The plugin reads as the stream's buffers, then each block's,
the KV groups, the layers, the head and the draft head.
tests/arch_fakes.h holds the fakes and the helpers every architecture test needs, included by
one translation unit a binary (neither binary links rad_core, as before); GLM-5.3's cases are
tests/glm5next_test.cpp, which includes only its plugin, with two cases new: every op the plugin
issues carries the operand count its schema declares (the kernel libraries' schemas under
$RADIANCE_HOME/kernels, counted as core/runtime/issue.cpp counts), and every declared weight
reads an entry the served container holds, at the dtype its stored encoding calls for (the
container's names and encodings as rad-info -v lists them).
Every declared name, declaration order and issue order is as it was: the pinned graph and step
hashes at one and eight ranks are the values arch_test pinned before the move (world 1
0xed3fc26c486ea1b5 / 0x98ba2952bb37b075, world 8 0x8204e073efdeee0c / 0x1279aecfe4e32d9a), and
arch_test's pins of the other architectures are unchanged.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Probe the expert encoding as qwen4exp does, declare the rotated input pair, set the GPTQ
calibration tap, and read expert sources stacked or per expert.
- ActFP8::q8_rot marks fed codes as rotated. NormQuantFP8 declares (ar_)rmsnorm_had_quant_i8g and
GateQuantFP8 declares gated_had_quant_i8g when an activation is fed and rotated. LinearFP8 takes
fed codes on an i8a8h weight only if their rotation is the weight's.
- The MLP no longer writes the bf16 silu product when the down projection is fed.
- qwen35_w8a8 feeds the normed input and the FFN activation only where libr4d declares the ops
(at TP2 the all-reduce form too), so the CPU graphs are unchanged.
A decode step's had_quant_act_i8g launches fall from 288 to 64; the 64 left quantise the attention
and delta-net outputs. The codes are the same bytes. On 2x R9700, against 1.9.0 with the RTN
container:
- KL rows are identical, and greedy answers are byte-identical at TP2 and TP1, with acceptance
unchanged.
- TP2: 33.98 -> 32.87 ms a decode step, 111.2 -> 114.9 tok/s.
- TP1: 55.81 -> 54.59 ms, 62.7 -> 64.1 tok/s.
- Prefill: +2%.
arch_test pins the unfused chain where the ops are undeclared, and the fed path where they are
(had_quant_act_i8g 8, rmsnorm_had_quant_i8g 16, gated_had_quant_i8g 8). The every-op-declared graph
hashes are re-pinned.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Gemma4TextScaledWordEmbedding multiplies the looked-up rows by `embed_scale.to(weight.dtype)`,
which is sqrt(5376) rounded to bf16: 73.5. gemma4_bf16 multiplied the trunk's embedding by the
unrounded 73.32, and the assistant head's entry, which reads the trunk's embedding module, did the
same. The first layer's norm hides a 0.25% scale, but the residual stream every later layer adds to
does not. arch/gemma4 has taken the bf16 value since it was written (53.0 at 2816).
Both now take embed_scale(n_embd), the bf16-rounded value. arch_test's two checks of the scale
expect 73.5, and its three pinned gemma4_bf16 graphs move with the `mult` they record; no other
model's pin moves.
On 4x R9700 at tp 4 the replies move against main's, as a 0.25% scale on the residual stream
would (7 of 7 long prompts, drafter off). A drafter trained on the reference's hidden states
tracks the corrected stream better: z-lab's DFlash drafter (the next change) accepts 2.88 tokens a
step over seven 2-6K-token prompts against 2.71 with the scale unrounded, and 5.21 against 4.91 on
a code prompt (270 against 259 tok/s).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ar_rmsnorm_quant_i8_4rank is the wide family's exact four-rank one-shot with the junction (the
residual add, the sandwich norm and the int8 quantiser) as its epilogue, as ar_hc_write_4rank is
that one-shot with hc_write. The reduce is the standalone exact all-reduce's arithmetic element by
element (fp32 from zero, ranks ascending, one rounding to bf16), so the reduced row matches it to
the bit, and the junction is rmsnorm_quant_i8's over that row. It shares the standalone
all-reduce's transport and instance and ends the engine's link hold itself, as docs/TP4.md asks of
a new collective row.
Every block takes one handshake, a system-scope release by its first thread and a system-scope
acquire by every wave. Both fences are needed: on 4x R9700 behind an EPYC root complex, dropping
either left the readers with stale scratch on nearly every element. `nblocks` 2 and 4 (fewer
handshakes, each block owning several rows) are tune points, off by default.
r4d_selftest's case of the same name holds every rank's reduced row, residual, output, codes and
scales byte for byte to all_reduce followed by rmsnorm_quant_i8 on four cards, at 1, 8, 40 and 97
rows of 5376 and 64 rows of 2816. r4d_selftest is now installed in the image, so a card box can run
the rows' checks without a build tree.
At four ranks a 31B decode step issued 121 standalone all-reduces, 119 of them followed by a
separate norm launch. The plugin now declares ar_rmsnorm_quant_i8_4rank for steps of up to 4 rows
(kAr4FoldRows), where it serves every junction but the last layer's feed-forward one: a decode step
issues 2 standalone reductions. Taller steps, every speculative verify among them, issue the pair
(the all-reduce, then rmsnorm_quant_i8): a one-shot sends three times the message a rank, and at 16
rows the standalone all-reduce's exact two-shot beats the fold's per-row handshakes.
On 4x R9700 (the w4a8 container, tp 4, two rounds): plain decode 90 / 90 / 89-90 tok/s against
86 / 87 / 86 for code / prose / story, and 85 against 82 after a 6442-token prompt, +4.7%; a
DFlash verify at 16 rows measured 300 tok/s on the pair against 276 on the fold, hence the band.
Both paths give the same bytes. Where no library declares the fold, every step issues the pair.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
LoRA for image and video generators:
- civitai and Hugging Face adapter files as published: kohya, ComfyUI and diffusers/PEFT key names;
LoRA, LoCon, LoHa, LoKr and full-weight diffs; DoRA, OFT and Tucker are refused by name
- stacked per request with a strength each, through the `loras` field or <lora:name:strength> tags
in the prompt; --lora-dir serves every file in a directory, GET /v1/loras lists them, and
--max-loras / --max-lora-rank size the slots on the card (generators default to rank 64)
- Krea 2, Qwen-Image 2.1, FLUX.3 [klein], MiniMax H3, LTX-2.5, Anima and SDXL
New models:
- Anima (base, aesthetic and turbo): Cosmos-Predict2 DiT with the Qwen3-0.6B text encoder and the
Qwen-Image VAE, on one card
- Stable Diffusion XL and its single-file finetunes (Illustrious, NoobAI including V-Pred, Pony),
read as civitai ships them, with the Euler, Euler a and DPM++ 2M samplers
Recipes:
- q38-27b-mxfp4-df2: any bf16 Qwen3.8-27B or finetune at MXFP4 with the DFlash2 drafter
- Krea 2 finetunes from civitai: scripts/krea2_native.py reads Krea's own key names, and
krea-2-fp8-unscaled keeps a plain-fp8 file's codes exactly
Changes: --max-num-batched-tokens defaults to 2048 (was 8192). Plugin ABI 25: out-of-tree plugins
must be rebuilt.
- sam_attn: tile queries and hoist the relative-position dots; the tower
drops from 0.44-2.09 s to 0.10-0.36 s per tile.
- processor: split OCR patch/LUT staging across rows, then make both bicubic
passes and the LUT append AVX2 (bit-exact, 1.15-1.38x host preprocessing).
- tower: batch the DeepEncoder across every tile segment of an encode pass.
Patch embed, the 12 SAM blocks, neck, the 24 CLIP blocks and the projector
run once per batch of up to 8 tiles (4 at the 64 grid); sam_attn and
attn_dense stay segment-independent through B+1 cu tables, and position
tables are host-staged PERSIST planes. B == 1 emits the old graph.
Fix the newline layout: the reference expands image_newline over every map
row, while the copy read past the one-row vector; with a multi-tile batch
that made the trailing cells live data and the decoder dropped the text at
the right margin of every line.
- attn: instantiate attn_paged_qrow at head_dim 128 (bf16 and fp8 caches) and
read OCR's q slice of the fused q|k|v plane in place, keeping the dense cast
as the fallback when the library does not serve the qrow row.
- tests: h128 attention emulator cases, a batched-tower arch test, an AVX2
bit-identity test, and a 15 s arch_test CPU budget for the image.
Measured through the router at 256 tokens: 8-page TTFT 4157 -> 1327 ms, 640
page 608 -> 284 ms, 8 concurrent pages 17.6 -> 4.26 s wall; decode unchanged
at ~344 tok/s. Parse gate 0.9901 text / 1 px on the deployed image.
New models:
- LTX-2.5 (base and distilled): video with a stereo soundtrack from text or from text and a first
frame, on one card, with its duration head, tiled VAE decoding, the diffusion decoder and the x2
latent upsampler
- Krea 2 Raw and Turbo, and FLUX.3 [klein] and its base: text to image, and for FLUX.3 edits from up
to ten reference pictures, on one card
- GLM-5.3-Flash from AMD's Quark MXFP4 export, on eight cards (John McDonough, Nunze)
- Gemma 3 / TranslateGemma 27B with an optional DFlash2 drafter (mici81)
Engine:
- --kv-cache-dtype fp8_v4 and k6_v4 for Gemma 3 and Qwen3.8-Flash-Next (mici81)
- the rotated int8 trunk (i8a8h) for Qwen3.8-27B (eddie168168)
- eight-rank all-reduce bands, weighted shards and pieces (Nunze); --host-headroom-mib (sfjes)
- the dashboard shows the single-stream decode floor and its most recent window (Memoria)
Fixes: prefix-cache reservations kept until their save lands (baKon), tool calls in Responses
namespaces (#119), system messages merged when a template refuses several (#137), a prefill
continued with no open step (#127), calibration of a Gram accumulation (#122), JSON Schema patterns
read unanchored (davetha), GLM-style tool calls, the KV floor counting every sequence's state.
Plugin ABI 24.
An architecture plugin for GLM-5.3-Flash (45 layers, 4096 wide) from its Quark MXFP4 export: four
mHC residual streams; KDA layers and full layers with absorbed MLA behind the DSA indexer; a MoE
block of 288 MXFP4 experts (top 8, sigmoid routing with a correction bias and route_scale 2.5) and
an ungated shared expert; clamped SwiGLU; the block-fp8 attention and MTP weights at their f32
scales; and its native MTP layer as the drafter. Under tensor parallelism experts shard by width,
MLA by whole heads, and the f32 router and index-head projections split their columns from 256 rows.
The MoE block's decode fusions are on by default (RADIANCE_GLM_ROUTER_FUSE,
RADIANCE_GLM_SWIGLU_QUANT, RADIANCE_GLM_GATHER_INVERSE; 0 restores the separate launches, byte for
byte). Its tool-call format is derived from the chat template, as for the other models.
data/recipes/glm53-mxfp4.recipe decodes only the combined MLA projection to bf16; every other
weight keeps its stored encoding.
arch_test declares the model at one, two, four and eight ranks and lints its steps: the mHC
connections, the routing's f32 path, the head-complete MLA shards, the indexer's cache pages and
tail ring, KDA's local heads, the expert geometry at TP4 and TP8, that the sizing declares give
the real graph at every arena level, where the decode fusions replace their launches, and, with
the fusions off, a pinned graph and step hash.
Co-Authored-By: Nunze <lorenz.lamping1@web.de>
The flag sets the trunk's cache to E4M3 plus a RAD_KVQ_* layout; a plugin offers the layouts it
serves in its probe and the server refuses any other, naming the plugin. qwen35_fp8 offers both
at head_dim 256, gqa 6, and declares the group at head_dim 200 / 176 (the row's bytes / 2), so
the core sizes pages as for fp8; a drafter's cache stays fp8. Qwen3.8-27B on two R9700s, KL
against bf16 on 17 long documents: fp8 0.039963 (518,800 tokens of KV), fp8_v4 0.040076
(664,400), k6_v4 0.039965 (755,184); prefill and decode at fp8's speed. ABI 23: two trailing
fields, the layout table regenerated.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On an MXFP4 container the fused junctions skip the bf16 activations the tap reads, and q/k/v and
gate_up Grams came out zero without a word (down likewise behind gelu_mul_quant_i8). Under
RADIANCE_CALIB_DIR no junction or fused down-quantiser is declared, so any container
calibrates, unfused; checked on the production MXFP4 container. RADIANCE_G3_CALIB_LAYERS
refuses trailing characters. Docs: which trunk fuses what, the four-stream numbers' two
workloads, which sizes are tested. arch_test's world-2 check counts the post-norm op.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
gemma4_bf16's block structure with Gemma 3's differences (modeling_gemma3, transformers 4.57):
GemmaRMSNorm everywhere, one head geometry, scores at query_pre_attn_scalar^-0.5, linear rotary
scaling on the global layers only, the bf16-held embedding scale, no value norm, soft-capping
and YaRN refused. Linears i8a8, mxfp4a8 and w4a8i8_asym over an activation scaled per
(row, 128), beside bf16 and w4a8 / w8a8: one int8 scale a row costs KL 0.097 at w8a8 on
Gemma 3's outlier channels. Fused junctions on a quantised trunk. A calibration tap
(RADIANCE_CALIB_DIR, RADIANCE_G3_CALIB_LAYERS), the column-split linears as rank parts.
A DFlash2 drafter as qwen35_fp8 declares one; rad_block_dflash2.h applies the drafter's
input_embedding_scale through embed_lookup's mult when it is not 1, so other drafters'
graphs are unchanged. Against transformers' float32 forward on a tiny Gemma 3: KL 0.00016 on
the host backend and the cards. arch_test: 7 cases.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A third build of the qwen35 source, as qwen35moe_fp8 is, claiming (qwen35, w8a8_fwht128).
Behind QWEN35_W8A8: check_format's method and fmt, a probe of the first delta-net input
projection that learns the trunk is rotated int8 before the activations are declared (and refuses
one that is not, plain int8 included: the descriptor names the rotation), and the plugin
identity; the four trunk activations then carry int8 code pairs.
It declines imported checkpoints (RAD_ARCH_SERVES_IMPORTS(0)): as the family's second quantised
plugin it would make every imported Qwen3.8 release (Quark, ParoQuant, GPTQ, NVFP4) refuse, so
those stay with qwen35_fp8.
arch_test: every trunk linear an i8a8h GEMM behind its own quantiser at one and two ranks, the
refusals (no int8 trunk, a plain one, another format, no fmt), lint clean with the MTP head and
with DFlash2, and two ArchCases (pinned graphs; libref's vocabulary serves it at one rank).
shipped_plugins_test lists the new key and holds each shipped family to at most one plugin that
takes imports. ARCHITECTURES.md and GUIDE.md list the plugin.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- video: MiniMax-H3 and FastVideo's FastH3 8-Step V2, a video with its stereo soundtrack from text
on OpenAI's /v1/videos, block fp8 on two cards
- music: MiniMax-Music3, songs from lyrics and a description on /v1/audio/speech
- speech: Breeze-TTS-2 on /v1/audio/speech and vLLM-Omni's realtime WebSocket
- runtime LoRA adapters beside the base model, picked per request by `model` (baKon, #105)
- several agent streams keep their cached history: --checkpoint-slots auto, the new default, sizes
the snapshot store by --max-num-seqs (#108)
- the Swift 1.5 27B W4 releases convert and serve: compressed-tensors AWQ and GPTQ int4, AutoRound,
ModelOpt NVFP4 (#110)
- the image's host tests pass where perf_event_open is refused, as in BuildKit's sandbox (#106)
- plugin ABI 21: out-of-tree plugins must be rebuilt
- every model serves without a GPU: libavx covers every op, so `--kernels libavx` alone serves
every shipped container
- Qwen3-ASR (zivius): speech to text on /v1/audio/transcriptions and live over /v1/realtime
- /v1/messages works with Claude Code as it ships (gearwave00001)
- a long agent conversation keeps its cached history when the client rewrites its last turn
(manueloverride)
- a stream's first event goes out with the first token, so llama-benchy measures prefill right
- opt-in --prefill-interleave (Smellyyyy, baKon) and --prefill-span (keptn42)
- four-rank TP releases the link early; four-rank selftests and docs/TP4.md (goodman-b)
- NVFP4 and FP8 compressed-tensors imports (devmilan); tools/rad-export for finetunes and LoRA
adapters (baKon)
- many fixes, among them lost tokens on stop strings under concurrency, keep-alive, MiniCPM5 tool
arguments and the CPU's vision and audio encoders
- plugin ABI 17 and changed op schemas: out-of-tree plugins must be rebuilt
- Gemma 4 31B (PRs #74, #75, #81, #86; sfjes, keptn42): sliding and global attention with their
own kernels, the assistant head as a drafter that reads the trunk's cache, the vision tower, a
fused w4a8 decode step, bf16 and compressed-tensors int4 checkpoints, and window snapshots so a
prefix hit on a sliding-window model resumes instead of prefilling again.
deploy/compose/gemma4-31b-w4a8.yaml serves keptn42's container on two cards
- ParoQuant (PRs #65, #66, #67; malic): Qwen3.8-27B checkpoints with learned Givens rotations,
as int4, int5 and MXFP4, imported without re-quantising, the prefill's rotations on the matrix
cores. deploy/compose/qwen3.8-27b-paro.yaml serves them on one card. A ParoQuant container made
with the PR builds is refused: convert it again with --reuse <old container>
- Gemma 4 26B-A4B with z-lab's DFlash drafter (PR #88; Perire): arch/gemma4 serves Google's bf16
checkpoint with the routed experts in block fp8 or bf16 (data/recipes/gemma4-26b-a4b-df*.recipe),
and libr4d gains its windowed paged attention, the fused sandwich-norm joins, expert_scale and
the sharded draft head's pair_argmax. A prefill chunk runs as two slices with its all-reduces
beside the compute, bit-exact with the whole step. The 31B's global layers take the windowed
attention too: an 11.5K-token prefill on two R9700s in 3.1 s instead of 4.9
- a startup that logs nothing for two minutes says where it waits (#89): the system call (a KFD
request by name), the library that made it, and its stack, which addr2line resolves against the
binary
- the prefix cache is kept in VRAM and host memory only (#70): the disk tier wrote every block and
snapshot a prompt produced, and its copies never outlived the process. --prefix-cache-host-mib
is renamed --prefix-cache-mib; --prefix-cache-dir and --prefix-cache-disk-mib are removed, and
startup refuses all three with what replaced them. The compose files no longer mount /data, and
.env no longer needs RADIANCE_STATE
- --prefix-cache-ttl S (default 3600, 0 never): a conversation no request has used for that long
leaves the cache, whichever tier holds it; radiance:prefix_cache_expired_total counts them. A
full host tier now drops its least recently used conversations
- --vision-tower-placement vram|ram (#84): ram keeps an encoder tower in pinned host memory and
gives its VRAM to the KV cache, read over the link once an image
- timings carry ttft_ms and total_ms (#85): the server's own time from the request body's arrival
to the first and the last token, queueing and tokenisation included
- a KV-cache recall that found a moved expert with nowhere to go stopped halfway and leaked the
slots it had already freed: after it every recall failed, the cache stayed short until a
restart, and requests failed with HTTP 500. A recall now waits for the slots it is owed and
always finishes
- a tool result or tool-call arguments that are not JSON are no longer refused as nesting past
1024 levels for their unmatched brackets (#90): only text that parses as JSON is held to the
bound, since nothing else is parsed into a tree
- the host-pool refusal names the limit that applies to pinned memory (RAM less 1/64 and
1.5 GiB), not ttm.pages_limit
- --embedding-placement auto, removed in 1.3.0, is refused with what replaced it
- for out-of-tree kernel libraries: gemm_nt_q gains two operands (pb1, pb2, the part bounds), and
the loader requires identical op schemas, so a library built against 1.4.0 must be rebuilt. For
architecture plugins, rad_op_declared(b, op) asks whether an op is in the loaded vocabulary
without declaring it
The two feed-forward arms of a Gemma 4 MoE layer read the same normed residual and meet only at
the feed-forward join; issued one after the other, the dense arm's three launches -- gate_up,
act_mul, down, ~36 us under --profile-ops at a 26B-A4B decode step on 4x R9700 -- wait behind the
routed arm's ~120 every layer. At a few rows its GEMMs are latency-bound, nowhere near the
bandwidth the experts' GEMMs take.
In a step that runs whole -- every decode and verify step, and a prefill chunk too short to cut --
the dense arm now rides the second lane: issued behind a join from lane 0 (the attention join is
its producer), beside the routed arm on lane 0, and joined back before the feed-forward reduction
reads both. Its rows of the join buffer and the routed arm's are disjoint. No collective rides it,
so the reductions keep lane 0 here and lane 1 in a cut prefill chunk, and a step's collectives are
on one lane as before. h, gate_up, ffn and ff2 are named to rad_buf_concurrent. Off with the
overlap's switch, RADIANCE_GEMMA4_OVERLAP=0, which now keeps every step on one stream; a startup
note says which.
arch_test: a decode step issues the dense arm's three launches a layer on lane 1 and every
all-reduce on lane 0, two joins a layer, and nothing on the two lanes that touches a common
element unordered; a 4095-token chunk the same; the cut chunks keep lane 1 for their reductions
alone. GUIDE.md's switch and ARCHITECTURES.md say so.
Not yet run on the cards.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The 26B-A4B's router reads rmsnorm(x) * w_r * hidden^-0.5 and its experts rmsnorm(x) * w_e,
quantised to E4M3 for the fp8 gate_up: an `rmsnorm` and an `rmsnorm_quant_fp8` a layer, each
reading back the x norm_add_norm has just written and taking the sum of squares it has just taken.
At decode that is 60 launches a step (8.3 and 7.8 us under --profile-ops on 4x R9700); at a
prefill, eleven passes of each a layer per 20K-token request.
norm_add_norm_route is norm_add_norm, then from the norm factor it already holds the router's row
by rmsnorm's expression, ((x * s) * w_r) * mult, and the experts' codes as rmsnorm_quant_fp8 writes
them: the bf16-rounded norm, a scale of amax * (1 / 448) a 128 columns (1 for an all-zero group),
the value times its reciprocal clamped to +-448, one v_cvt_pk_fp8_f32. Element i is thread i % 256
at slot i / 256, so a group is four waves at one slot -- a wave's max, then the four through LDS.
Its own name rather than optional operands on norm_add_norm: the codes need whole 128-column
groups, which the plain join does not, and the arch falls back cleanly where it does not resolve.
A device row and a host arm (one helper with norm_add_norm's), the schema, OPS.md.
arch/gemma4 asks for it on every layer whose gate_up is block fp8 -- the user's fp8gu container,
every layer -- and then issues neither op_rnorm nor op_enorm; it declares both still, and
norm_add_norm and the chain behind it, for where it does not resolve. The routed arm's two norm
gains are declared ahead of the attention join now, which names them. The overlap takes either
join. A startup note counts the layers that take it.
The same rounding as the chain, but for the order a sum of squares is added in, as every join here:
g4k_emu holds the kernel to a chain summed in its block order bit for bit -- x, y, the router's
row, every code and scale -- at the 26B-A4B's 2816 at four heights, at 128, 3072, 3200 and 6144,
and with an all-zero group; against the host arm, no code more than a step off. The emulator gains
v_cvt_pk_fp8_f32, through the project's saturating encoder. arch_test: with fp8 gate_up experts the
route op resolves on all six layers, a decode step issues it and no rmsnorm_quant_fp8 and one
rmsnorm fewer a layer; refused, norm_add_norm and both launches; a tp-4 prefill through the
overlap issues it a slice and keeps every reduction ordered.
Not yet run on the cards.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every input of a drafter layer was three launches after its all-reduce: `add` (x += h), `rmsnorm`
(x -> h) and `quant_act_fp8` (h -> hq | hs), ~8 us each under --profile-ops on 4x R9700 and a few
unprofiled, twice a layer -- thirty a draft pass, every decode step.
libr4d's `rmsnorm_quant_fp8` is that chain in one pass where it takes the residual operand (the
fused_add_rms_norm form): the norm of the bf16-rounded sum, the codes of the bf16-rounded norm,
which its row states is the chain's function. The drafter now issues it for both inputs of every
layer, the attention input of layer 0 with no residual -- x as the embedding left it -- and the
last layer's trailing add stays, ahead of the final norm, which no quantiser follows. Nineteen
launches fewer a draft pass. Where nothing serves the op the chain is declared and issued as
before. A draft is verified whatever it is, so this cannot change what is accepted.
arch_test: a draft pass issues ten rmsnorm_quant_fp8 and one add, the residual operand x and the
delta h past layer 0 and x alone at it; refused, the chain's ten adds and fifteen quantisers.
Not yet run on the cards.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On gemma-4-26B-A4B at tp 4 on 4x R9700 the all-reduces were 47% of a 20K-token prefill under
--profile-ops (957 of 2020 ms): a layer reduces T x E after attention and both arms' 2T x E after
the feed-forward, at ~16.5 GB/s a rank on the link, against ~8 ms of compute a layer at the average
chunk. Run whole, the two take turns.
A chunk of two routed passes or more (4096 tokens) now runs as two slices, and every trunk
all-reduce rides the runtime's second lane (rad_lane) beside the other slice's compute: slice A's
attention reduction under slice B's output projection, slice B's under slice A's two arms, slice
A's feed-forward reduction under slice B's arms, and slice B's under the next layer's join and
projections of slice A. Attention runs whole -- it reads every row's keys. A model of the measured
times puts it at up to a quarter off an unprofiled prefill; --profile-ops syncs every op and cannot
show it.
The same bits as the whole step: the cut is a whole number of routed passes, so the routed arm
makes the passes the whole step makes, and both slices are at least one pass, above every row band
the sliced kernels have (the GEMM's 16 and 64, the reduction's one-shot edge) -- core's rule four
for the second lane. The slice's partials sit dense-then-routed in its own run of the join buffer,
so each slice's feed-forward reduction is one message.
The order: a reduction is issued on lane 1 behind a join from lane 0, its producer; lane 0 joins
lane 1 back before the consumer and before the next reduction is issued, since a join orders behind
everything its lane has issued. The embedding's reduction stays on lane 0, ahead of everything lane
1 is first joined behind, so the collectives keep one order on every rank. The two buffers reduced
in place are named to rad_buf_concurrent. Taken where the joins are fused, the wire is exact and
there is more than one rank; RADIANCE_GEMMA4_OVERLAP=0 runs every chunk whole, and the startup note
says which. A decode step never takes the lane.
routed() takes a run of rows and the join row its partial lands at; attention between the
projections and the output projection moves into attend(), which both paths issue.
arch_test records the lane of each issue and where each join sits, and a new test holds a 6-layer
26B-A4B with the DFlash taps, at tp 4: no two issues on different lanes that touch a common element
go unordered (taking every operand as read and written; dropping one wait makes it count six), lane
1 carries the trunk's 4 x 6 reductions at the slices' sizes and nothing else, the slices issue the
whole step's rows by op and its routed passes, a 4095-token chunk and a decode step stay on one
lane. GUIDE.md has the switch, ARCHITECTURES.md the paragraph.
Not yet run on the cards.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The drafter's head was `gemm_nt` over the target's bf16 table -- 352 MiB a rank at tp 4, every draft
pass, 566 us of a 26B-A4B decode step under --profile-ops on 4x R9700: the widest read on the draft
path, and the "first thing to change once the model runs" its own comment named.
A container may now hold the table a second time as `dflash.draft_head.weight`, block fp8 -- one
checkpoint tensor, two logical weights, as rad_block_dflash2.h does it -- made by the recipe line
dflash.draft_head.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
which the three gemma4-26b-a4b -df recipes now carry. Where the copy is there, the head is
quant_act_fp8 over the gathered rows and gemm_nt_q over the copy at fp8a8: half the bytes, for 176
MiB a rank more. The copy is row-sharded exactly as the table, so a rank's rows are the same
vocabulary slice and row_topk's vocab_off, the all_gather and pair_argmax are unchanged. Drafts are
verified, so the coarser logits change what is proposed and never what is accepted --
draft_n_accepted says whether they propose worse; there is no rerank against the bf16 table yet.
Where the copy is not there -- every container converted before this, or one whose recipe made it
something other than block fp8 -- the head reads the bf16 table exactly as before. The decision is
the stored encoding's (weight_enc on the copy's name), and the copy's name map entry alone writes
nothing: rad-convert walks the declared weights. The startup note names the head in use. The
block-fp8 test moves to one helper, which the routed experts' encoding check now uses too.
arch_test: with the copy's encoding block fp8, the copy is declared and the head is gemm_nt_q over
it from the quantised rows; without, nothing is declared and the head is gemm_nt over the table;
a draft pass issues the head once either way. ARCHITECTURES.md says so.
Not yet run on the cards; it needs a container converted with the new recipe line.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
8772d5b handed the sliding layers' attn_paged q as a column slice of the fused [q|k|v] row. gemma4k
reads that; libr4d's paged attention reads q only dense and refuses the slice with RAD_E_STRIDE,
which stops the engine at the first step. Under attn_paged the first library in --kernels wins, so
the slice was only safe with gemma4k ahead of libr4d -- and the deploy script's default order
(libr4d,gemma4k,libavx) took the server down at layer 0's attention on both profile runs.
gemma4k now declares the same kernels a second time under attn_paged_qrow: attn_paged's schema
field for field, with q read at its own row pitch. Only gemma4k declares it, so it resolves there or
nowhere. The sliding layers ask for it once; where it resolves they read q in place (no lift), and
where it does not -- a hierarchy without gemma4k, or RADIANCE_GEMMA4_FUSE=0 -- q is lifted into a
dense block by a `cast` again and attn_paged reads that, which every attention library takes. The
lift's buffer is declared only then, since an unnamed buffer is live for the whole program. A miss
is the swa group's first op carrying a block_size, and answers rad_kv_block_size with the
RAD_KV_BLOCK it declares, as attn_paged would. No libref row, as the joins.
The kernel order still matters for speed -- gemma4k first is the order this model was measured with
(ARCHITECTURES.md) -- but no longer for whether the server runs. A startup note says which form
was taken.
arch_test: the slice reaches attn_paged_qrow and never attn_paged; refused, every sliding layer
lifts q for attn_paged; a decode step issues either form; and the three older gemma4 tests
count the sliding layers' attention under its new name. docs: OPS.md's row and paragraph (and a
line of the joins' text reflowed to the width, as one of gemma4.cpp's), ARCHITECTURES.md's kernel
paragraph, which now names expert_scale too, and GUIDE's FUSE row.
Not yet run on the cards.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Gemma 4 multiplies each renormalised routing weight by per_expert_scale of the expert it chose.
In the conventional vocabulary that is an `embed_lookup` of the [n_expert, 1] table by the ids
and a `mul` into the weights -- two launches a MoE layer, a few dozen elements each at decode
(--profile-ops: ~0.26 and ~0.22 ms a step across the 30 layers). gemma4k's `expert_scale` is the
pair as one kernel, ew = bf16(ew * w_e[id]), with an id outside the table reading 0 as
embed_lookup's missed row does: one product rounded once, so the pair's value bit for bit.
Like the joins it has no libref row on purpose, so arch/gemma4 falls back to the pair wherever
gemma4k is not loaded, and RADIANCE_GEMMA4_FUSE=0 turns it off with them. 30 launches a step the
fewer.
g4k_emu: device and host rows against the pair over 32 shapes -- top-k 1 and 8, pitched rows,
pads and one-past-the-end ids, rows past M untouched -- every element equal. arch_test: a decode
step scales in one launch, and in two with it refused. docs/OPS.md: the row and its paragraph;
GUIDE: what the switch now covers.
Not yet run on the cards.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
At decode heights the router GEMM (128 x 2816), its top-k and the expert sort are each one small
workgroup's work behind a full dispatch: --profile-ops put the three at ~0.27, 0.29 and 0.24 ms a
step across the 30 MoE layers. libr4d already fuses them for the Qwen MoE blocks --
`router_topk_scatter` for the pair, `router_gemm_topk_scatter` with the GEMM in front -- and
documents both as byte-identical to the launches they replace, so the routing does not move.
arch/gemma4 now asks for them as rad_block_moe_fp8.h does: the pair up to the sort's
single-workgroup bound (1024 routing slots, 128 rows at top-8), the GEMM form up to the skinny
GEMM's decode band (64 rows), and the separate ops for a pass past either, declared regardless.
The per-expert scale and the experts' input norm sit between them in the issue order and read only
the ids and weights the fused op writes. Two launches a MoE layer the fewer at decode, 60 a step.
arch_test: a decode step routes with the fused op; refused, with the pair; both refused, with the
three separate ops -- and the per-expert scale and the gather run in every case.
Not yet run on the cards.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
join_add_scale takes an optional gain `w_n` and output `y` (both or neither) and, given them,
writes y = rmsnorm(x) * w_n over the residual it has just stored -- the next layer's
input_layernorm, or the final norm after the last layer. Those norms read the x the join writes
and nothing else, so each was a launch of its own and a second read of the row; now it is a fourth
reduction in a block that already holds x in registers. On the 26B-A4B that is 30 launches a
forward pass the fewer (29 input norms and the final norm), at decode a step's worth of ~8 us
launches.
Rounding where the chain rounds: y is taken over the bf16 x the join stores, with libr4d's
expression, so g4k_emu holds it to the chain bit for bit (+next cases, decode to prefill heights,
odd widths and pitches) and to the host arm within a flipped rounding.
arch/gemma4 declares every layer's input-norm gain ahead of the layers so a join can name the
next one's; where a join resolves, the norm it replaces is neither declared nor issued, and where
it does not, the chain is as before. docs/OPS.md: the row and its paragraph. arch_test: fused,
the only x -> h rmsnorm is layer 0's and every join writes h; refused, all thirteen come back.
Not yet run on the cards.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The q lift -- a `cast` copying q out of the fused [q|k|v] projection into a dense block -- was
there because libr4d's paged attention reads q only dense. gemma4k's takes q at any row pitch
(its head_view, and g4k_emu's q-pitch-slice cases), and gemma4k serves all of Gemma 4's attention,
so the slice goes straight in: one launch and a [T, q] copy less on each of the 25 sliding layers,
every step. With libr4d ahead of gemma4k its attention refuses the slice by name (RAD_E_STRIDE)
rather than reading it wrong.
arch_test: no copy between projection and attention, and the attention reads `qkv_s`.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claims ("gemma4", ""): a container converted from Google's bf16 checkpoint, the recipe choosing
what is fp8. gemma4_bf16 keeps ("gemma4", "compressed-tensors"), the CT-INT4 dense release; the
two do not overlap. Serves gemma-4-26B-A4B-it (128 experts of 704, top 8) and the dense sizes
without per-layer embeddings, with a DFlash block-diffusion drafter merged at convert time.
The readings that stay plausible when wrong, each explained at its site:
- Proportional rope is not a partial rotary: the full layers rotate the first 64 frequency pairs
of the 512-wide head at theta^(-2j/512), pair j = channels (j, j + 256), declared as full-width
NeoX with the frequencies past pair 63 divided by 1e30 through the YaRN ramp `rope` carries.
- K is V on the full layers: V is the un-normed, un-rotated k projection, so its norm is issued
before the key norm overwrites `k`.
- The router reads the residual through a gainless rmsnorm times its `scale` times hidden^-0.5,
and per_expert_scale multiplies after the renormalised top-k.
- Two post-norms a layer's feed-forward, one an arm, each arm's partial reduced before its norm;
both partials share one [2T, n_embd] buffer so one all-reduce carries them.
- The embedding scale is sqrt(hidden) rounded to bf16 (53.0, not 53.066).
- The sliding layers' KV group is RAD_KV_FULL with the window on the attention op: a WINDOW
group is not prefix-cached, and on this tree a hit on one re-prefills; FULL keeps the hit.
- fp8 experts are two tables by parity, so a rank holds an even count; down at K = 704 cannot be
fp8 (whole 128-blocks), hence the 768-padded recipe.
- The sharded draft head's merge is pair_argmax at R = 2 on the wire.
- The drafter's tap copy is declared at the end of the layer it taps, where it is issued. The
buffer planner takes liveness from declaration order; declared once after the trunk, it let the
plan share `dflash_src` with `moe_edn`, which every MoE layer writes, whenever the sizes
allowed. At --max-num-seqs 16 they did, and on the cards DFlash accepted 2% of its drafts
(97 tok/s against 135 with speculation off and 186 with the taps intact), the text fluent
throughout.
The sandwich joins are asked for as norm_add_norm / join_add_scale (gemma4k) and declared as the
rmsnorm / add chain where nothing serves them; RADIANCE_GEMMA4_FUSE=0 asks for the chain. The
reply format is the shared one (arch/rad_gemma4_chat.h), so tool calls are parsed in the engine;
the plugin as measured declared reasoning only and left calls to an out-of-tree sidecar, so the
call path is untested on this plugin's containers.
arch_test: the MoE trunk declares both arms and six of each join; both KV groups FULL with the
window on the op; the full layers' rope over the whole head with the ramp at 63.5..64; with the
joins refused, the chain is declared and issued instead; both Gemma 4 plugins export one format;
with a DFlash drafter, `dflash_src` is live from the first tap layer (its range overlaps
`moe_edn`'s, so no plan can share them) and a step writes each tap once.
Measured on 4x R9700 at TP4 (gemma-4-26B-A4B-it + DFlash, gate_up experts block fp8), with
gemma4k and --draft-window adaptive: a story at T 1 177 tok/s, greedy thinking 572 tok/s, code at
T 0 319-334 tok/s.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The gemma4_bf16 architecture (sliding and global attention, the proportional RoPE ladder, the
assistant head as a drafter that reads the trunk's cache, the vision tower), its w4a8 decode
junctions, the h512/gqa8 and h256/gqa2 attention kernels, compressed-tensors int4 import, multi-EOS
from generation_config, the call/reasoning reply format, a window group that keeps the keys a
prefill chunk still reads, and window snapshots in checkpoint slots so a prefix hit on a
sliding-window trunk resumes.
Fixes on top: the investigation switches and diagnostic blocks out of the served paths; int4 import
through the checkpoint import framework; attention_k_eq_v from the config; the fused junctions only
where every reader takes their pair; a shared-KV head binds no group of its own; the compose file
without HSA_ENABLE_IPC_MODE_LEGACY (TP2 fails with it on ROCm 10.1); a checkpoint carries a window
only where a hit resumes from it; the README says the linked container is keptn42's calibrated GPTQ
build and what the in-tree recipe gives.
- Qwen3.8-Flash-Next on one card: the heat engine moves 64 experts a step (was 8), its copies and
the prefill's expert staging run on the card's DMA engines instead of as copy kernels, and at
decode the next layer's likeliest experts are copied onto the card ahead of its GEMMs. Against
1.3.0 at --tp 1: prefill +17-20% from 8K tokens up, throughput under load +16-20%
- deploy/compose/flashnext-tp1.yaml: Qwen3.8-Flash-Next on one card and 64 GB of host RAM
(4096-token prefill steps, 4 sequences, a 301K-token cache)
- #61: --busy-prefill-chunk (default auto): a long prefill leaves the rest of the step to the
requests decoding beside it and to new arrivals, instead of taking all of it (baKon)
- LiquidAI's LFM2 and LFM2-VL, and d1's /v1/systemone (after zivius's PR #50)
- a startup report: every option with its value and where it came from, the hardware, and what
on it costs speed with the fix; /diagnostics serves it (behind the API key; without one, only
to the same machine)
- #69: a GPU memory fault names the buffer and kernel argument behind it and ends the server at
once (exit status 70), instead of hanging or writing a core of tens of gigabytes
- #64: a card without Resizable BAR is refused at startup, naming what to turn on, instead of
crashing at the first launch
- the image is built with ROCm 10.1 (the host's amdgpu driver must support it), with ROCm's
libLLVM rebuilt so the same source compiles to the same kernels every time; a source build
takes ROCm 10.1 or 7.2
- #71: the image ships curl, jq and a CA bundle, so --model <HF repo id> works in the container,
and hfget.sh runs under its busybox (baKon)
- --profile-ops shows how long each op's lane sat idle before it; cardclock.py skips an
integrated GPU instead of stopping
Between two w4a8 blocks the stream ran five single-row dispatches
(post-norm, add, layer scalar, norm, quantiser), q, k and v quantised the
same norm output three times, the attention prologue was five more ops
and down's input two. Now every junction is one rmsnorm_quant_i8 (at two
ranks on the exact wire ar_rmsnorm_quant_i8, with the all-reduce in it),
q, k and v read one int8 pair, the prologue is qkv_norm_rope and down's
input gelu_mul_quant_i8. The trunk pass at k=3 goes from 1786 to 840
dispatches.
Byte-identical to the unfused step: greedy output equal at k=0 and k=3.
A kernel set without an op keeps that op's chain; RADIANCE_G4_FUSE=0
keeps every chain, for an A/B against the same build. arch_test checks
the issued op sequence fused, at two ranks, and with the ops refused.
Google's Gemma 4 assistant (Gemma4AssistantForCausalLM), merged under
`draft.` by `rad-convert --draft-model`, declared when the container carries
it and the deployment speculates (max_spec > 0):
x = pre_projection(concat(E_trunk[tok] * sqrt(n_trunk), h_trunk))
x = 4 layers (3 sliding, 1 full): q-only attention over the TRUNK's cache,
o_proj, plain-gain sandwich norms, GELU ffn, per-layer scalar
hd = norm(x); logits = the head's own tied table (no soft-cap)
h' = post_projection(hd), the next round's hidden state
h_trunk is the trunk's final-normed hidden state. Each head layer reads the
last trunk layer of its class (58 sliding, 59 full on the 31B), as vLLM wires
it. The head keeps no cache, so it is declared with rad_drafter_shared_kv:
one row a drafting sequence, every round at the committed position.
TP: q heads row-sharded with the trunk's kv heads; o_proj and down are
column-sharded and all-reduced before their post-norm; projections and norms
replicated; the lm_head vocab-sharded through the ordinary sampler chain.
Declare refuses a head whose kv geometry, window, rotary or vocabulary differs
from the trunk's, and use_ordered_embeddings (centroid masking). The probe
answers draft depth 3 for `--num-speculative-tokens auto`.
arch_test: no head without one or at max_spec 0; shapes, name maps, the
drafter declaration; the issue order of a history pass and a round; the
attention reading trunk layers 10/11 of the 12-layer fixture; TP2 reduces
before each post-norm; a history pass of the wrong shape is refused.
Gemma 4's template is one llama.cpp reads with a hand-written handler, so the template analysis
found no format in it: the server warned "this model's reply format cannot be described",
returned the thought channel as content and refused every request with tools (HTTP 400).
The plugin now states the format its tokenizer_config.json declares (`response_template`), in
gemma4_chat_format.h, exported through RAD_ARCH_CHAT_FORMAT:
thinking <|channel>thought\n ... <channel|>, reasoning_anywhere
calls <|tool_call>call:NAME{...}<tool_call|>, repeated, triggers on <|tool_call>
the object bare keys, strings between <|"|> and <|"|>, other values as JSON writes them
The template closes an empty channel in the generation prompt when thinking is off and opens one
after a tool response when it is on; RAD_CHAT_THINK_FROM_PROMPT reads both. llama.cpp's handler
records an extra thought channel after the answer and a lone <channel|>; reasoning_anywhere reads
the first as reasoning and drops the second, so neither reaches the content.
chatparse_gemma4_test, against the model's own template (tests/data/chat/gemma4) and llama.cpp's
Gemma 4 parser as the oracle (tests/legacy, which now takes a declared format): every reply the
template renders reads back as the message it rendered, byte for byte as llama.cpp reads it; the
shapes the model writes and the ways it leaves the format; thinking on, off, and after a tool
response; reasoning_format none; a conversation with role:tool results rendered into the open
turn and continued; every truncation, fuzzed replies and a 200 KB string under the streaming
contract; the call grammar against llama.cpp's on rendered calls, tool_choice required and a
response format; and the chat bridge serving it, with the decoder rendering <|"|>.
arch_test holds the export to the header.
End to end on the 31B QAT checkpoint, two R9700 at TP 2: 60 requests over greedy and
temperature 1.0 / top_k 64 / top_p 0.95, streaming and not, thinking on and off. Every request
with tools came back with finish_reason "tool_calls" and JSON arguments -- one call, two parallel
calls, integer and boolean arguments -- every follow-up with role:tool results as an answer with
finish_reason "stop", and no <|channel>, <channel|>, <|tool_call> or <|"|> reached any content or
reasoning_content. With thinking off the model writes <|channel>thought\n<channel|> itself
before its answer to a tool result; it is read as an empty thought.
ladder param on rope/rope_table across ref/avx/r4d legs; embed_lookup gains its
runtime scale under the canonical registry name (mult). Default-preserving:
existing checkpoints replay unchanged (kbench rope fixture 44/44).
- EmbeddingGemma 2 (google/embeddinggemma-2): text, image, video and audio embeddings on the
card (libr4d) and on the CPU (libavx); prompt_name, Matryoshka dimensions, image budgets,
mixed content parts and the messages form on /v1/embeddings
- #43: on serves that lend the activation arena to the experts (Qwen3.8-Flash-Next with
expert_tiered), every image after the first read its rows from the wrong place -- garbage
replies, or an earlier request's image. Fixed
- the Qwen vision towers' attention resolves on the card again (broken on main after 1.2.3,
never released)
- #42: a warning at startup when amdgpu cwsr_enable is 0, and a stalled queue is reported as
slow or stuck; the guide covers the GPU-hang-and-reset chain
- Static YaRN for the Qwen rotary paths (#37): a container whose config names YaRN gets it in
attention, the QSA index keys and a DFlash2 drafter; one reader for every rotary type, and a
LLaMA container whose type is not served (llama3, longrope, dynamic) is refused by name.
- --rope-scaling yarn:FACTOR[:ORIG] (#38) writes YaRN over a container's own rotary keys at load,
no reconvert; the persisted prefix cache's fingerprint carries the resolved rotary.
- An uneven world's cheaper rank (#36) pages the common token count and gives the rest of its
VRAM to its experts; a plan and pool that disagree refuse to start.
- MoE prefill (#35): wide gather, parallel scan and run-map prefix, 256-column down tile, early
weight loads -- by rule, bit-identical.
- MoE decode (#34): the sorted operand's own down kernel, its column tiles by routed rows.
- --draft-window fixed|adaptive (#24): a per-sequence draft window priced by measured step time,
one head depth per step over the batch; fixed stays the default. New metric
radiance:draft_position_accepted_total and Grafana panels.
- Out-of-tree plugin builds compile to the tree's device code from any build directory.