Qwen single-token block ABI
Compose an OM-2 program with one om2 header, math.om, the required block files, then the caller. Both entry points are ordinary Omega functions. Inputs and weights are distinct caller-owned, bounded f32 arrays. Outputs are unscaled f32 activations for the caller's output projection. Each call consumes one finite projected token. Pack projections in checkpoint dimension order and widen weights to f32 before calling.
| Model argument | Pinned text config | Full Q heads | KV heads | Linear V heads | Layers |
|---|---|---|---|---|---|
| 27 | qwen3.8-27b-fp8-017b9c7a | 24 | 4 | 48 | 64 |
| 35 | qwen3.6-35b-a3b-fp8-95a723d0 | 16 | 2 | 32 | 40 |
Pass the absolute zero-based transformer layer. Full attention occupies layers 3, 7, 11 and every fourth layer thereafter. Start each layer at position 0 to reset it. Advance that layer by exactly one position per call through 8191. Position 0 can restart a layer at any time. The program owns static state and scratch for one sequence. Serialize calls. An invalid model, layer, block kind, position, or discontinuity traps 5 before mutation. The only active output is the first 6144 floats for model 27 or 4096 floats for model 35. The remainder of the caller's output buffer is untouched.
Gated DeltaNet
qwen_delta_step model:ulong layer:ulong pos:ulong x:view f32[16480] w:view f32[41184] y:edit f32[6144]
With H linear value heads and C = 4096 + 128H, concatenate the following active projection rows into x, with no inter-row padding.
| Start (floats) | Shape, row major | Contents |
|---|---|---|
| 0 | [C] | Contiguous Q[16,128], K[16,128], V[H,128] |
| C | [H,128] | Z projection |
| C + 128H | [H,2] | Paired a[h], b[h] |
Weights use fixed offsets for both models. The unused gaps on model 35 are ignored.
| Start (floats) | Shape | Contents |
|---|---|---|
| 0 | [C,4] | Depthwise convolution coefficients, oldest to current |
| 40960 | [H] | A_log |
| 41008 | [H] | dt_bias |
| 41056 | [128] | Gated RMSNorm weight, used directly |
Each layer retains three raw QKV rows, oldest first, and an f32 matrix [H,128 key,128 value]. After convolution and SiLU, normalize Q and K by their respective L2 norms with epsilon 1e-6. Scale Q by the reciprocal square root of 128. Each value head shares the key head at floor(h / (H / 16)). Decay the state before predicting V, update it with the gated innovation, then read from the updated state. The final per-value-head RMSNorm uses epsilon 1e-6 and multiplies by its weight and SiLU(Z).
Full attention
qwen_attention_step model:ulong layer:ulong pos:ulong x:view f32[14336] w:view f32[512] y:edit f32[6144]
For Q query heads and K KV heads, x concatenates [Q,2,256], [K,256], [K,256]. Each query head holds its query first, then its gate. The remaining two arrays are the raw keys and values. Weights concatenate the checkpoint q_norm[256] and k_norm[256], with the zero-centred weights supplied directly. The function adds one to each weight. Input and output dimensions use the original model order.
Text positions rotate pairs (j,j+32) for j in [0,32) with theta 10000000. The other 192 dimensions pass through. Q remains f32. K after normalization and rotation, and raw V, round to BF16 nearest-even before any score or value read. Each layer stores K and V together per position, KV head and dimension. The implementation uses the graph's cache precision and Core's natural dimension order. Causal softmax includes the current row, uses a max shift and scales the f32 dot product by 1/16. The elementwise output gate is sigmoid of the corresponding query head's gate row.
Sources and verification
Core reference at 94979bab48fe45491f4e5f29899deaf62152f025, crates/aien-inference-abi/src/qwen38.rs, functions delta_net and attention. Graph sources at e5b32567a7aff3ce594e3254a622a846a6cd190b in ~/work/CudappOm/omega-mv/src/ include omega_gpu_q36_graph.c, omega_gpu_q38_graph.c, omega_blackwell_codegen_gdn.h and omega_blackwell_codegen_attn256.h. The scalar exp, sigmoid and sin/cos routines come from Core's om/flint/ops.om. Accumulations use ordered binary32 operations. GPU warp reductions, device permutation, projection scaling and device roundoff are outside the CPU parity claim.
| Input | SHA-256 |
|---|---|
| q27/config.json | 74227dd615bf1ea975aa676bdf355a0379858c12f394b5365cd9dfa5fc2c70bc |
| qwen3.6-35b-a3b-fp8-95a723d0/config.json | 570ef7ea45a7e1d3de2b1d3c70c4ac3562d0e768acdc195778cb4f4d95025845 |
From this directory, reproduce the CPU gate with an AArch64 host, Python 3 and NumPy. The Python process supplies synthetic inputs and the reference only. The application unit is seeded Omega.
scratch=$(mktemp -d)
git --git-dir="$HOME/git/omega-mv.git" show 3086ed3ca1061b2625a48d175cd5ac990e783655:seed/out/omc > "$scratch/omc"
chmod 700 "$scratch/omc"
OPENBLAS_NUM_THREADS=1 python3 tests/check.py "$scratch/omc"
The gate verifies the compiler SHA-256 before compiling. It compares every active output and samples of recurrent matrices, raw convolution tails, and cached K/V after each call. It interleaves layers and restarts the same slots. The position-8191 fixture installs an all-zero synthetic prefix in a fresh layer. Full-length sequential prefill remains unmeasured.