Skip to main content

Module qwen38

Module qwen38 

Source
Expand description

Qwen3.8-27B authored in LOGOS.

The model is a hybrid: of its 64 layers, 48 are Gated DeltaNet (a fixed-size associative memory, rewritten per token) and 16 are gated attention (a growing KV cache). full_attention_interval = 4 puts the attention layers at indices 3, 7, 11 … 63. That 3:1 ratio is why the model caches only a quarter of its depth, and it is what makes the checkpoint cheap to run relative to its parameter count.

gen_qwen38_lg emits the whole forward as a .lg program — the artifact the claim “authored in LOGOS” rests on. Every line is ordinary LOGOS tensor sugar; nothing here is a compiler intrinsic. Following the Qwen3-30B precedent the .lg is the SINGLE-TOKEN forward (KV caches declared one row deep), and the generation harness is what grows the cache and replays the step.

Structs§

Qwen38Cfg
Everything the emitter needs, read from the checkpoint rather than assumed. Field names mirror the GGUF metadata keys so a mismatch is easy to spot.

Constants§

QWEN38_EXTRA_KERNELS
The last two kernels the hybrid needs: an f32-weight GEMV for GDN’s tiny gate projections (quantizing a [d, 48] matrix would risk the gates for a rounding error that buys 0.26% of bandwidth), a KV-cache store that splits the fused projection’s k and v halves into their caches, and the SwiGLU epilogue fused with the activation re-quantization so the FFN’s middle never round-trips through global memory as f32.

Functions§

emit_qwen38_generate
Emit a self-contained CUDA program that generates from the real Qwen3.8-27B weights and reports throughput.
emit_qwen38_mtp_probe
Emit the MTP ACCEPT-RATE PROBE.
gen_qwen38_decode_batch_embed_lg
A batched decode step’s embedding lookups alone.
gen_qwen38_decode_batch_head_lg
A batched decode step’s head alone.
gen_qwen38_decode_batch_layer_lg
Layer l of a batched decode step alone.
gen_qwen38_decode_batch_lg
B decode steps at once, each sequence with its own state. See author::decode_batch.
gen_qwen38_decode_batch_tp_layer_lg
Layer l of a batched tensor-parallel decode step alone.
gen_qwen38_decode_batch_tp_lg
A batched decode step, tensor-parallel over tp chips. See author::tp_decode_batch.
gen_qwen38_decode_embed_lg
A decode step’s embedding lookup alone.
gen_qwen38_decode_head_lg
A decode step’s head alone: the final norm, the LM head and the arg-max.
gen_qwen38_decode_layer_lg
Layer l of a decode step alone, its attention reading a KV cache of ctx positions up to pos.
gen_qwen38_decode_step_lg
One decode step: token tok at position pos (1-based) in, the next token out, the KV caches and the Gated-DeltaNet state carried. See author::decode_step.
gen_qwen38_filled_lg
The authored forward (gen_qwen38_lg) with every declared tensor filled DETERMINISTICALLY right after its declaration (a hash of the element index salted by the tensor’s name, in (-0.2, 0.2)) and the first and last logit shown — the self-contained program the demo corpus (examples/rdu_demo/qwen38_tiny.lg) and the tier-agreement locks run without a weight file. Fills follow declarations because the weights are declared per block, interleaved with the compute that reads them.
gen_qwen38_head_lg
The final norm and LM head alone.
gen_qwen38_layer_lg
Layer l alone, as the forward writes it.
gen_qwen38_lg
The whole Qwen3.8 forward as a LOGOS program — the single token with no history — and its weight manifest.
gen_qwen38_prefill_head_lg
A prefill chunk’s head alone.
gen_qwen38_prefill_layer_lg
Layer l of a prefill chunk of chunk rows from pos0 alone.
gen_qwen38_prefill_lg
A prefill chunk of one sequence from position pos0. See author::prefill.
gen_qwen38_tp_decode_layer_lg
Layer l of a tensor-parallel decode step alone.
gen_qwen38_tp_decode_step_lg
A whole decode step, tensor-parallel over tp chips. See author::tp_decode_step.
qwen38_rope_cache
The rotary cache for rows positions, rope_dim / 2 pairs a row: row p (1-based) holds the cosines and the sines of (p − 1)·θ^(−2i/rope_dim) — the angles gk_qk_norm_rope_part turns 0-based position p − 1 by, over the rotary width — each computed in f64 and rounded once.