LexiSuite Docs

LexiEngine: Inkling 2 on Vulkan (inkling2_loop)

State of version 8f6f542, November 25, 2026. Speed against llama.cpp and Strata: Benchmarks. Fitting and adapters: LexiEngine-Inkling-2-Fit-And-LoRA.

LexiEngine's runtime for Inkling-2-Mini (Apache-2.0, released 2026-11-20): the text backbone on one Vulkan device, served by lexi-engine --backend vulkan. Source:

Part Where
Device runtime and server wrapper crates/server/src/inkling_vulkan.rs (InklingDevice, InklingVulkanRuntime, MemoryPlan)
Kernels crates/vulkan-ops/src/shaders/inkling.comp, inkling_attn.comp, inkling_attn_cm.comp, inkling_expert.comp, inkling_expert_cm.comp; Rust side crates/vulkan-ops/src/inkling_ops.rs
Runner (checks and speed) crates/server/examples/inkling_vulkan.rs
CPU reference crates/model-inkling (tool inkling-reference)
Routing and report crates/server/src/main.rs (ahead of the generic factories), crates/server/src/rcc_served_architectures.rs (Vulkan lane only)
Tokenizer pre-tokenizer inkling2 = the GPT-4o splitting, crates/tokenizer/src/lx36_pretokenizers.rs
llama.cpp patches used for conversion and the baseline at the end of this page

Measured on version 8f6f542 (November 25, 2026)

One run each on this version's code, Radeon RX 7900 XTX, 4-bit caches, greedy, the draft head read from the model file (the file that also carries the image tower). The sections below record the development of the runtime commit by commit; where an earlier commit's figure differs from this table, this table is the state of the version.

Prompt (tokens) Prompt (tok/s) Generation, 64 tokens (tok/s) With the draft head (tok/s) Plain in the drafting run (tok/s)
4,096 2,379.7 66.6 132.4 58.0
16,384 2,248.3 64.7 131.6 56.8
261,632 1,163.6 48.9 63.8 44.9
523,264 757.0 39.7 47.1 36.8

Retrieval of ten planted facts: 10 of 10 at 260,864 tokens, 10 of 10 at 523,264. Accuracy (510 positions, 4-bit caches, against the reference of the published weights): mean KL 0.0037 token by token, 0.0038 in 16-token passes; unrounded caches against the reference of the same file: KL 0.00000 over 48 tokens and 0.00000 over 1,024 positions.

1. The model

24 layers, width 2,304, 24 query heads and 8 key/value heads of 128 values, vocabulary 200,058 (tables padded to 201,024), 128 routed experts of width 1,152 with 8 used per token, context up to 1,048,576 in the file's metadata.

The loop. Layers 6 to 17 (the core) run three times with shared weights. A forward pass applies layers 0-5 once, the core three times (each pass starting again from the stream that entered the core; passes 2 and 3 take a gated message from the pass before through low-rank controllers of rank 64 on the query, key, value and expert inputs), then layers 18-23 once: 24 + 2 x 12 = 48 layer applications, each with its own cache slot. Slots 0-23 are the first pass; slot 24 + 12 (p - 2) + (l - 6) is core layer l in pass p. Residuals are mixed by blocks of 6 layers (attention residuals with learned queries over the block outputs so far).

Attention. Layers 5, 11, 17 and 23 see every position (global); the other 20 see a window of 1,024. Global slots: layers 5 and 23 once, 11 and 17 three times = 8 slots; windowed slots: 40. Three query heads share a key/value head. No rotary positions: a relative bias by distance (16 values per head, distances below 1,024), queries and relative rows clipped to a norm (qk_clip 22.63, relative_clip 8) and scaled on global layers by tau = 1 + 0.1 ln(max(1, (position + 1) / 8,192)); a per-head sink logit (one extra softmax term), and a sigmoid output gate. Keys and values pass a 4-tap causal convolution (static taps, plus taps computed from the input on global layers) before they are cached; the attention and expert outputs pass 4-tap convolutions too. A logit soft cap of 30.

Experts. Router with a bias, 8 of 128, route weights scaled by 8; gate and up fused, activation "situ" with betas 4 and 25.

2. The file it reads

The runtime reads llama.cpp's GGUF layout for inkling2_loop. The file used for every number here is Inkling-2-Mini-NVFP4exp-Q8.gguf (17.6 GB), converted with the patch in section 8:

The expert kernels read NVFP4 and Q8_0 rows; the dense products read Q8_0 through the engine's exact row kernels (runs of up to 8 tokens) and its matrix-core Q8_0 kernel (prompt passes of a multiple of 16).

3. How a token is computed

The draft head (speculative decoding, since 2026-11-21)

mtp.safetensors holds a 3-layer block drafter (the vendor calls it DSpark) with a recurrent ("Markov") head; its wiring follows the public SGLang implementation. The runtime loads it next to the main model (Q8_0 matrices; 1.45 GB with F32 matrices at first, 0.90 GB since) from the GGUF itself when the file carries it (since 2026-11-22: tensors under draft. names, the checkpoint's config.json as inkling2_loop.draft.config, written by inkling-draft-pack, section 8), so drafting is on by default for such a file (LEXI_INKLING_DRAFT=0 turns it off; a served model leaves a carried head off, with a message, when the memory plan cannot fit it beside the caches), or from a checkpoint folder named by LEXI_INKLING_DRAFT (config.json with mtp_config, and mtp.safetensors). Both give the same values:

4. Cache rows

4-bit rows by default and the only format the server uses: llama.cpp's q4_0 layout per head of 128 values, 4 blocks of 32 with a binary16 step and levels (code - 8) x step: 18 words = 72 bytes a head. Before rounding, keys are rotated with a Walsh-Hadamard transform over the head's 128 values and values per half of 64 (as llama.cpp does); queries are rotated alike and attention outputs rotated back. LEXI_INKLING_KV=f32 in the runner keeps rows as computed, for checking the arithmetic only (never a serving or benchmark setting). There is no 8-bit row format.

A windowed slot keeps window + 3,072 positions (one pass of 2,048 writes its rows before they are read); a global slot keeps every position. The short convolutions keep their last 3 input rows per slot.

5. Memory at 262,144 positions

Item Arithmetic Bytes
Weights every tensor of the file on the device 17.62 GB
Global caches 8 slots x keys and values x 262,144 positions x 8 heads x 72 bytes 2,415,919,104
Windowed caches 40 slots x 2 x 4,096 positions x 8 heads x 72 bytes 188,743,680
Caches together 2.60 GB
Prompt scratch planned at 480,000 bytes per pass token (2,048 tokens: 0.98 GB); measured: 0.58 GB of stream/projection rows plus the grouped-expert rows about 1 GB
Kept free pipelines, attention chunk parts, driver 0.54 GB
Draft head (carried by the GGUF or LEXI_INKLING_DRAFT) Q8_0 matrices, the 257-row fold table, 8-bit context rows for 262,144 positions, scratch 1.45 GB measured (the plan counts 1.38 GB)

MemoryPlan (in inkling_vulkan.rs) puts every weight and cache row on the first device and takes the largest pass of 2,048 / 1,024 / 512 / 256 tokens that fits beside them; a context whose weights and caches do not fit is refused with these figures (the runtime never moves cache rows to system memory). On the RX 7900 XTX (25.73 GB reported free) 262,144 positions load with passes of 2,048, and so do 524,288 positions (5.02 GB of caches; loaded and measured 2026-11-21, below); 1,048,576 need 9.85 GB (refused on a 24 GB card, below). The unit tests caches_at_262144_positions and the_plan_takes_the_largest_pass_that_fits_and_refuses_what_cannot hold this arithmetic, including 524,288 on the XTX's reported 25.73 GB.

Measured load (2026-11-21, lexi-engine --backend vulkan -c 262144, commit 199a3602): "weights 17.62 GB, caches 2.60 GB (262144 positions), scratch 0.58 GB (passes of 2048); loaded in 13.8 s".

524,288 positions (measured 2026-11-21)

Item Bytes
Weights 17.62 GB
Global caches: 8 slots x keys and values x 524,288 positions x 8 heads x 72 bytes 4,831,838,208
Windowed caches (as at 262,144) 188,743,680
Caches together 5.02 GB
Prompt scratch, passes of 2,048 (the plan takes 2,048 on the RX 7900 XTX) 0.58 GB measured
Draft head at this capacity (its global layer's 8-bit context rows double; passes of 1,024 then, scratch 0.30 GB) 2.00 GB measured

1,048,576 positions would need 9.85 GB of 4-bit caches beside 17.62 GB of weights, about 28.1 GB with scratch and margin: more than a 24 GB card holds, so the plan refuses it (it would take a larger card or weights kept off the card).

Measured load at 524,288 (runner, LEXI_INKLING_CONTEXT=524288 LEXI_INKLING_CHUNK=2048): "weights 17.62 GB, caches 5.02 GB (524288 positions), scratch 0.58 GB (passes of 2048); loaded in 13.1 s"; the card showed 23.73 of 25.75 GB in use during the prompt.

6. Serving

lexi-engine --backend vulkan -m Inkling-2-Mini-NVFP4exp-Q8.gguf -c 262144 --host 127.0.0.1 --port PORT

Typed decisions (since 2026-11-21)

lexi-engine --decisions (and --decision-admin with operator credentials, --decision-artifact-bank DIR with a 0700 folder) serves /v1/decisions, /v1/decisions/batch, /v1/decisions/capabilities and the admin routes (/admin/decisions/calibrate/l1, /admin/decisions/fit/l2, artifacts) on this runtime, through the same Decider the CPU runtime uses.

LoRA adapters (since 2026-11-21)

lexi-engine --lora FILE (several allowed, each with its scale as the generic path parses it) applies GGUF LoRA adapters (llama.cpp's convention as lexi-engine-lora reads it: general.type = adapter, adapter.type = lora, adapter.lora.alpha, F32 pairs blk.N.attn_{q,k,v,output}.weight.lora_a [input, rank] and .lora_b [rank, output]) to the attention projections q, k, v and output of each physical layer; the core layers' terms apply on all three passes. Other targets and embedding adapters are refused; the rank must be a multiple of 4. The delta is scale x alpha / rank x B (A x), computed beside the Q8_0 product as two F32 row products and an add, in the prompt and the single-token paths alike; adapters on one projection add. inkling-lora-synth writes a synthetic adapter for checks (fixed seed; --zero for B = 0), and inkling-reference --gguf FILE --lora ADAPTER computes the same terms on the CPU.

Pictures (since 2026-11-24)

What a picture is to the model. One row of 2,304 values per 40 x 40-pixel cell of the picture, in raster order, at the positions of that many placeholder tokens (<|unused_200054|>, id 200054). The rows come from the image tower (the vision. tensors of a file that carries it) and take the place of the placeholder's embedding; they do not pass the embedding norm. The model has no rotary positions, so a picture needs no position table: its cells are ordinary consecutive positions.

In a chat request. /v1/chat/completions, streaming and not, takes image_url parts with data:image/png or data:image/jpeg base64 URLs in user and tool messages. The model's own template renders the message: every text part and every picture is its own block, in the order sent, a picture as ROLE<|content_image|><|unused_200054|><|end_message|>. After tokenizing, the one placeholder of each picture is repeated to the picture's cell count. A placeholder must stand alone between <|content_image|> and <|end_message|> and there must be exactly one per picture: message text that spells the model's image tokens is refused (400), as is a template that drops a picture. usage.prompt_tokens counts the cells (cells + 3 per picture).

Where the tower runs. On host threads in this version (the encoder behind PictureEncoder); a device encoder is a later step. The memory plan therefore leaves the vision. tensors out of the device weights (they were counted as weights before; 636.5 MB in the checkpoint's BF16), and counts nothing on the device for pictures: a picture's rows are staged in system memory that the card reads (9,216 bytes a cell: 37.7 MB for 4,096 cells) for the time of the request, and copied into the pass's stream rows by one copy command per run of picture positions in a pass. Host memory: the tower's weights as the encoder holds them, the decoded picture (3 bytes a pixel), and the rows twice (the encoder's result, kept for the next turn, and the staged copy).

In a device pass. InklingDevice::pass embeds the pass's token ids as before (the picture positions hold the placeholder id) and then copies the picture rows that fall inside the pass over the embedded rows, before the first layer application. A picture that crosses pass boundaries is copied in parts: prompt passes (multiples of 16 up to the plan's pass) and the tail's runs of up to 8 take the part of each picture inside them (tested without a device: rows_land_on_their_positions_across_pass_boundaries). A pass that copies rows is not replayed from the recorded token commands. The whole rest of a picture prompt arrives in one call (DeviceModelRuntime::prefill_with_soft_tokens), runs in the same passes as a text prompt, and can be cancelled between passes; prefill progress is reported once, at its end.

Prompt reuse with pictures. Token ids cannot tell two pictures apart: every cell is the same id. The device keeps, beside the token history, the picture spans it holds (first position, rows held, SHA-256 of the picture's grid and row values). A position of a new prompt is the same as the held one only when the ids are equal and both sides hold the same row of the same picture there, or neither holds picture rows. So:

Tested without a device: a_prompt_that_differs_only_in_the_picture_is_not_the_same, a_sequence_cut_inside_a_picture_continues_only_with_that_picture. The scheduler used to switch reuse off for every image prompt; it now asks the prefix owner (PrefixCache::attach_with_vision, whose default still reuses nothing, so the other runtimes are unchanged). The server keeps the encoded rows of the previous request's pictures, by the digest of their pixels: a conversation's next turn sends its pictures again and does not encode them again (tested: a_picture_request_reaches_the_model_with_a_token_per_cell).

The draft head needs nothing for pictures: its context rows are written from the main model's features at every position, picture positions included; a speculative step's anchor is always a generated token; verification passes carry no picture rows. Greedy and sampled drafting run on picture prompts as on text prompts. inkling_vulkan spec has no picture mode; the served check runs with the head the file carries (job i1124-024).

Typed decisions take token ids only (the decisions API has no picture part). A decision prompt never reuses cached positions from a held picture on, and the shortcut for a repeated decision prompt is not taken while the caches hold picture rows: a decision asked after a picture conversation runs its own prompt. Placeholder ids in a decision's text are ordinary tokens (the table's embedding, normed).

Limits of one request (what it may make the server read, decode and compute), all refused with 400 and the figures before any encoding:

Limit Value
Picture parts 256
One picture, encoded 32 MiB, and the server's body limit over all of them
One picture, decoded 64 x 1,024 x 1,024 = 67,108,864 pixels (the engine's own PNG and baseline-JPEG decoders; no WebP, no remote URLs)
One picture's grid what the tower takes (PictureEncoder::grid; its refusal is passed on with its figures)
All pictures of a request their cells, the text tokens and max_tokens fit the loaded context; LEXI_INKLING_PICTURE_CELLS=N lowers the cells of one request to N
Host memory the rows, twice, fit the memory the system reports as available

There is no fixed budget: the context and the tower decide. One request can therefore ask for as many encoder runs as its pictures; a dropped client is noticed between pictures (the tower takes a picture whole) and between device passes.

A file without the tower serves text as before and refuses a picture with 400: "this model file carries no image tower (no vision. tensors, or no encoder for them in this build): pictures are not accepted ...". /v1/responses and the token-count endpoints refuse this model's pictures ("accepted by /v1/chat/completions only").

What the server reports. GET /v1/models, the loaded model's row: "capabilities" contains "vision" and "image_input": {"supported": true, "formats": ["png", "jpeg"], "cell_pixels": 40, "roles": ["user", "tool"], "max_pictures": 256, "max_picture_bytes": 33554432, "max_picture_pixels": 67108864, "max_cells_per_request": null or N, "encoder": "host", ...} only when the file carries the tower and its encoder is loaded; otherwise "image_input": {"supported": false, "reason": ...} and no "vision". lexi-engine --accelerator-capabilities-json, which knows no file, lists "image_input_architectures": {"vulkan": ["inkling2_loop"]}: the architectures whose runtime takes pictures when the file carries the tower (rcc_served_architectures::image_input).

7. Environment switches

Switch Where Effect
LEXI_INKLING_PASS=N server prompt pass of N tokens (a multiple of 16, at most 2,048) instead of the memory plan's choice
LEXI_INKLING_DRAFT=DIR / =0 server, runner spec load the draft head from the checkpoint folder DIR / run without a draft head (default: the head the GGUF carries, if any)
LEXI_INKLING_EXPERT_SHARE=0 runtime runs of up to 8 tokens: every (token, route) pair reads its expert's rows (no sharing between pairs of the same expert)
LEXI_INKLING_LOADS_FIRST=0 runtime norms, depth mix, branch, controllers, expert combine and attention merge with the loops that load as they add
LEXI_INKLING_DRAFT_ARGMAX2=0 runtime the draft's greedy pick in one workgroup
LEXI_INKLING_EXPERT_LEVELS=arith runtime runs of up to 8 tokens: the 4-bit levels decoded by compares and selects instead of the table
LEXI_INKLING_EXPERT_OUTER=0 / =1 runtime the one-token-at-a-time expert form never / for every run of up to 8 (default: single tokens)
LEXI_INKLING_ATTN_WHT=barriers runtime the per-token attention parts rotate the queries through shared memory (seven barriers)
LEXI_INKLING_EXPERT_LANES=1 runtime per-token experts with a row per lane (the kernel before 2026-11-21)
LEXI_INKLING_SPEC_RUN=N runtime tokens of a verification pass (2 to 8; default 8 below 131,072 positions, 4 beyond)
LEXI_INKLING_WINDOW_CORES=0 runtime prompt attention of windowed layers on the scalar kernel
LEXI_INKLING_ATTN_CHUNKS=0 runtime single tokens walk all their keys in one workgroup per head (the kernel before 2026-11-21)
LEXI_INKLING_ATTN_CORES=0 runtime prompt attention of global layers on the scalar kernel
LEXI_INKLING_EXPERT_CORES=0 runtime prompt experts per (token, route) instead of grouped matrix products (slow; for checks)
LEXI_INKLING_FAST_ROWS=0 runtime dense products of passes on the exact row kernels instead of the matrix-core Q8_0 kernel
LEXI_INKLING_PROFILE=1 runtime waits after every stage and records device time per stage (slower; not a speed figure)
LEXI_INKLING_FUSED_CONTROL=0 runtime the controllers as five commands each (pair, three F32 row products, apply) instead of two commands per set
LEXI_INKLING_ATTN_REGACC=0 runtime matrix-core prompt attention with the sums through shared memory every key block (the kernel before)
LEXI_INKLING_ATTN_Q32=0 runtime prompt attention with 16 queries a workgroup also for passes of a multiple of 32 tokens
LEXI_INKLING_BATCH_SMALL=0 runtime a visit's three input norms and its key and value history updates as separate commands
LEXI_INKLING_MIX_FIXED=0 runtime the depth mix kernel with its sums in an array indexed by runtime counts (the kernel before)
LEXI_INKLING_EXPERT_BSHARED=0, LEXI_INKLING_EXPERT_PREFETCH=0 runtime prompt experts, gate and up: each subgroup loads its input fragments from memory / no prefetch of the next weight words
LEXI_INKLING_EXPERT_DOWN_PREFETCH=0, LEXI_INKLING_EXPERT_DOWN_BSHARED=1 runtime prompt experts, down: no prefetch / the input slice staged (slower)
LEXI_INKLING_DRAFT_CM=0, LEXI_INKLING_DRAFT_FOLD16=0 runtime draft head: the scalar context attention (parts of 512 positions) / the F32 fold table
LEXI_INKLING_SPEC_TAU=T runtime the product of estimated acceptances a verification pass goes down to (default 0.3)
LEXI_INKLING_DEPS=1 runtime prints the dependency structure of the first token's command list (commands, planned barriers, depth)
LEXI_INKLING_W4A8=1 runtime runs of up to 8 tokens: 4-bit experts' gate and up products with 8-bit inputs (integer dot products); off by default
LEXI_INKLING_SPEC_POLICY=adaptive / =fixed runtime verification length chosen per step by expected tokens per millisecond / the lengths by depth without the confidence cut
LEXI_INKLING_STEP_POSITION=0, LEXI_INKLING_REPLAY=0 runtime positions in the recorded commands / every token's commands recorded again
LEXI_INKLING_INPUT8=experts|projections|all runtime accuracy ablation: those inputs rounded to 8 bits per block of 32 before the F32 kernels (no speed change)
LEXI_INKLING_EXPERT_BALLOT=0 / =1 runtime runs of up to 8 tokens: every lane of a shared expert kernel scans the route table for its expert's pairs / the subgroup ballot also for single tokens (default: the ballot, 2 loads a lane, for runs of more than one token; needs at most 64 pairs)
LEXI_INKLING_BUS_SMALL=1 runtime route table, position word, token ids and logits in system memory the card reads over the bus (the placement before 2026-11-23); default: on the device, ids and position copied in at the start of a pass and logits copied out at its end for host readers
LEXI_INKLING_ATTN_TOKEN_Y=0 / =2 runtime attention parts of a run with one workgroup per head and chunk walking the run's tokens / a workgroup per head, token and chunk on every layer (default: on windowed layers)
LEXI_VK_FLOOR_NO_BARRIERS=1 recording queue timing diagnostic, results wrong by design: no barrier after a batch's first command, to show what the barriers between dependent commands cost
LEXI_INKLING_CONTEXT=N runner cache positions (default the longest sequence plus 512)
LEXI_INKLING_CHUNK=N runner tokens per prompt pass (default 256; 2,048 for speed runs)
LEXI_INKLING_PROMPT_RUNS=N runner bench prompt repetitions (default 2; the last is the warm one)
LEXI_INKLING_KV=f32 runner unrounded cache rows, for checking the arithmetic only

GGML_VK_ALLOW_SYSMEM_FALLBACK=0 stays set for every run that loads a model.

Picture input:

Switch Where Effect
LEXI_INKLING_PICTURE_CELLS=N server most cells of all pictures of one chat request (default: what the context holds)
LEXI_INKLING_PLACEHOLDER=ID runner image the placeholder token id whose runs take the pictures' rows (default 200054)

8. Converting the vendor checkpoint

The checkpoint ships safetensors with 40 expert tensors NVFP4 (E2M1 values, an E4M3 scale per 16, a per-expert amax and denominator), 8 MXFP8, the rest BF16 / F32, and no model code. llama.cpp 29b52d398 (build 12600, the first with Inkling 2) converts it by decoding the experts to F32 and re-quantizing them: at 8 bits that file is 27.8 GB and does not fit a 24 GB card. The patch at the end of this page (llama.cpp-29b52d398-inkling2.diff) adds three things:

  1. conversion/inkling2.py: with INKLING2_NATIVE_NVFP4=1 the NVFP4 experts are repacked into ggml NVFP4 blocks unchanged (gate and up rows de-interleaved into the fused tensor) and the per-expert factor goes into a .scale tensor; the products' inputs stay at full precision (prec_a4 false) unless INKLING2_A4=1.
  2. src/llama-model.cpp: the loop's extra cache slots share the physical layer's expert scale tensors. Without it llama.cpp runs passes 2 and 3 of the core with unscaled experts and produces garbage with this file (upstream does not hit it because its own conversion writes no scale tensors).
  3. src/llama-graph.cpp: LLAMA_NVFP4_ACC_F32 keeps F32 accumulation for NVFP4 products (diagnostic).

Conversion (the trunk type follows --outtype; the run that wrote the measured file used q8_0, its exact command line was not recorded):

git -C llama.cpp checkout 29b52d398 && git -C llama.cpp apply llama.cpp-29b52d398-inkling2.diff
INKLING2_NATIVE_NVFP4=1 python3 llama.cpp/convert_hf_to_gguf.py CHECKPOINT_DIR --outtype q8_0 --outfile Inkling-2-Mini-NVFP4exp-Q8.gguf

The result: 744 tensors, 17.6 GB, architecture inkling2_loop. The same file runs in LexiEngine and in the patched llama.cpp.

To carry the draft head in the file (since 2026-11-22), the engine's own tool writes a copy with it added:

inkling-draft-pack Inkling-2-Mini-NVFP4exp-Q8.gguf CHECKPOINT_DIR Inkling-2-Mini-NVFP4exp-Q8-draft.gguf

Every metadata entry and tensor of the source is copied unchanged and in order; the 54 tensors of the checkpoint's mtp.safetensors are added as stored (BF16) under draft. names and its config.json as inkling2_loop.draft.config. The output is 18.26 GB (60 s on the scratch NVMe; it needs that much free space). The engine reads the main model from it exactly as from the source file.

9. Reference and checks

The CPU reference (crates/model-inkling) is a port of llama.cpp 29b52d398's inkling2 / inkling2-loop graph. It reads the vendor checkpoint directly (experts decoded exactly) or, with --gguf, the converted file's weights:

cargo build --offline --locked --release -p lexi-engine-model-inkling -p lexi-engine-model-maxwell -p lexi-engine-server --features vulkan --example inkling_vulkan
inkling-reference CHECKPOINT_DIR IDS OUT [--gguf FILE] [--cache-4bit] [--inputs exact|fp4] [--last N] [--score BASELINE]
maxwell-compare BASELINE OTHER IDS        # KL, same top token and perplexity of two logits files for the same ids

Token files hold one sequence per line, comma-separated ids. Checks after a change of the runtime or its kernels:

Check Command Must give
Arithmetic LEXI_INKLING_KV=f32 inkling_vulkan logits GGUF IDS OUT, then maxwell-compare REF OUT IDS against inkling-reference ... --gguf GGUF mean KL 0.00000
Same prompt twice inkling_vulkan prefill GGUF IDS OUT "same prompt twice identical: true"
Second sequence after a reset inkling_vulkan logits GGUF IDS OUT with two lines in IDS, compared row by row with each line run alone equal
4-bit accuracy inkling_vulkan logits and passes on 2 x 512 tokens against the vendor-checkpoint reference, second halves (510 rows) about llama.cpp's figure (0.0037)
Old and new kernels the same command with LEXI_INKLING_ATTN_CHUNKS=0 LEXI_INKLING_ATTN_CORES=0 same generated tokens
GPU kernel tests cargo test -p lexi-engine-vulkan-ops --features vulkan --test maxwell_attn --test maxwell_hc --test qwen4exp_exact_rows pass (shared row kernels)

The reference's --inputs fp4 mode (4-bit inputs to the 4-bit experts, as the vendor requires) is a reading of the checkpoint's quantization config; there is no vendor code to check it against, and it is not verified.

Picture input (2026-11-24):

Check Command Must give
Picture rows, arithmetic LEXI_INKLING_KV=f32 inkling_vulkan image GGUF PICTURE.rows IDS OUT, then maxwell-compare REF OUT IDS against the CPU reference's run over the same rows mean KL 0.00000, same top token 100% over 34 positions (16-token passes: KL 0.00005); job i1124-023, 2026-11-24
Picture prompt twice the same command's output "picture prompt twice identical: true" (job i1124-023)
Reuse with pictures the same command's output "picture reuse checks: pass": the same picture keeps the held sequence, another picture behind the same ids and the ids without a picture keep nothing; "another picture gives other logits: true" (KL 4.40; job i1124-023: Keep(34), None, None)
Served lexi-engine on a file carrying the tower, one chat request per picture: three one-colour pictures behind the same token ids, then a second turn the answers follow the pictures (Red, Blue, Green behind the same 34 token ids); the second turn reports 34 cached tokens. A repeated identical request reported 0 cached (job i1124-024, 2026-11-24): reuse across separate identical requests is not shown yet

PICTURE.rows is what inkling-vision-reference writes (a text line inkling-vision-reference v1 cols=C rows=R width=W, then the rows as little-endian F32); several pictures are joined by commas and take the sequence's runs of the placeholder in order.

10. Measured (RX 7900 XTX 24 GB, RADV, i7-9700; 4-bit caches unless stated)

Accuracy against the exact CPU reference (vendor checkpoint, F32 weights as stored, F32 caches), text = a 2 x 512-token document, the 510 rows llama-perplexity scores:

Run Commit, date Mean KL Median Same top token
LexiEngine single tokens 2c0f15fe kernels, 2026-11-21 0.00385 0.00011 98.24%
LexiEngine prompt kernels (16-token passes) 2c0f15fe kernels, 2026-11-21 0.00338 0.00009 99.22%
LexiEngine single tokens 2ac529bd, 2026-11-20 0.00425 0.00009 98.24%
LexiEngine prompt kernels 2ac529bd, 2026-11-20 0.00343 0.00010 98.82%
llama.cpp 29b52d398 + patch, -ctk q4_0 -ctv q4_0 2026-11-20 0.00371 0.00007 98.82%

Arithmetic (unrounded caches, against the reference computed from the same file): 48 tokens KL 0.00000 (top logits equal to 7 digits); 1,024 positions one at a time with the split-key attention KL 0.00000, worst 0.000 (the earlier single walk: 0.00002, worst 0.002), 2026-11-21.

Speed: see the numbers recorded for each commit in the table below. Single runs; "prompt" is the warm second prompt in the process unless stated.

Commit, date Prompt 4,096 Prompt 16,384 Generation at 4,096 Generation at 16,384 Prompt 261,632 (first in process) Generation at 261,632
2ac529bd, 2026-11-20 1,531 tok/s 1,324 35.1 31.8 385.6 (678.5 s) 11.0
e2184ab5, 2026-11-21, idle box 1,676.4 1,568.9 39.92 38.96 791.0 (330.8 s) 33.26
394bb21b, 2026-11-21, idle box 2,015.6 1,877.5 43.83 42.78 851.8 (307.2 s) 35.40
a4c86246 (recorded forward), 2026-11-21, idle box 2,004.1* 1,884.2* 50.36 49.12 868.3 (301.3 s) 39.31
this commit (controllers, prompt attention in registers with 32 queries), idle box 2,244.5* 2,147.8* 52.37 50.93 1,145.7 (228.4 s) 40.24
the same with LEXI_INKLING_W4A8=1 2,242.5* 2,146.3* 55.44 53.88 see below see below

* one cold prompt per process (LEXI_INKLING_PROMPT_RUNS=1), 128 generated tokens. At 261,632: load 17.62 + 2.60 + 0.58 GB in 12.9 s. The prompt at 261,632 by attention kernel (switches; the first figure on the round's previous build, which also held the fused mix and norm, neutral for prompts): sums through shared memory 297.9 s (878.2 tok/s), sums in registers with 16 queries 274.7 s (952.5), with 32 queries 228.4 s (1,145.7).

Decode on 2026-11-22 (idle box; bench: one cold prompt per process and 128 generated tokens; spec: the 16,384-token prompt and 256 tokens, the speculative tokens identical to plain greedy in every run; the draft head from the checkpoint folder or the GGUF give the same proposals):

Commit Generation at 4,096 Generation at 16,384 Speculative at 16,384 Per step: proposing / verifying Same with LEXI_INKLING_W4A8=1
7066af82 (code of 5ce20cde) 54.28 tok/s 52.56 84.67 (6.24 tokens a step) 5.8 / 65.7 ms 98.17
2c29e8aa (loads together, shared experts, two-pass draft pick) 60.36 58.99 99.72 (5.93) 4.8 / 52.6 ms 108.42
a79755d7 (level table, single-token expert form) 66.24 64.97 110.01 (5.93) 4.6 / 47.3 ms 112.17

Drafting by kind of text at 16,384 (a79755d7; prompts of 16,384 tokens: the engine's English documents, its Rust source, a JSON array of generated records): prose 83.90 tok/s (3.31 tokens a step), code 100.47 (5.06), JSON 127.70 (7.00; 36 of 37 passes took all 8, so the 8-token block is the limit there); the spec runner's plain loop 56.0. On 2c29e8aa: 77.25, 92.63, 118.28. The acceptance moved from 6.24 to 5.93 tokens a step on the 16,384 prompt when the shared expert kernel came in: its results differ in the last bits, so the draft sees slightly different features.

Where a token's time goes (a79755d7, one token at 16,384, GPU profile): the 4-bit expert kernels 41.8 us (gate and up, 23.9 MB: about 570 GB/s) and 24.2 us (down, 11.9 MB: about 490 GB/s) a visit, 2.9 ms a token (4.7 ms before the shared kernel, the table and the single-token form); the Q8_0 expert visits about 790 / 620 GB/s; the dense projections 13-14 us on 7.5 MB and 4.4 us on 2.5 MB (about 540-570 GB/s: short reads pay the dispatch's ramp and tail); the head 0.60 ms on 490 MB (about 815 GB/s). All weight reads together: about 6.2 ms for about 3.17 GB (510 GB/s against the card's roughly 800). The other half of the device time (about 6.6 ms) is the small steps and the attention: attention parts and merge 19.6 + 17.1 us a visit, the depth mixes 7.6 us x 120, the controllers' apply step 17.9 us x 48, and 3-7 us for each cache-row, history, branch, norm and router step; each is a short chain of dependent memory reads with little else on the card.

Served at 524,288 (2c29e8aa code, lexi-engine -c 524288 on the GGUF that carries the draft head, without LEXI_INKLING_DRAFT; the Fibonacci chat request, prompt included): the plan takes the head (weights 19.56 GB, passes of 1,024); greedy 80.4 tok/s, temperature 0.001 80.0 (the same answer), temperature 0.7 84.6 (sampled speculation); with LEXI_INKLING_DRAFT=0 50.9 (first request), 56.2 and 56.1. Retrieval at 262,144 (r262k10, 2c29e8aa): 10 of 10.

Speculative decoding with the draft head (LEXI_INKLING_DRAFT=src inkling_vulkan spec GGUF IDS COUNT, greedy, 2026-11-21; the speculative tokens are identical to plain greedy decoding in every run). The commit after 394bb21b (the draft attention's key tiles padded against shared-memory bank conflicts) changes only the draft head:

Prompt Commit Plain Speculative Tokens per verification pass Per step: proposing / verifying
16,384 tokens, 256 generated 394bb21b 42.65 tok/s 78.64 tok/s 6.29 (runs of 8) 8.9 / 69.4 ms
16,384 tokens, 256 generated after 394bb21b 42.52 tok/s 79.06 tok/s 6.29 (runs of 8) 7.7 / 70.2 ms
261,632 tokens (262,144 positions), 128 generated 394bb21b 35.36 tok/s 37.40 tok/s 3.28 (runs of 4) 27.5 / 59.5 ms
261,632 tokens (262,144 positions), 128 generated after 394bb21b 35.68 tok/s 40.88 tok/s 3.28 (runs of 4) 19.4 / 60.1 ms
261,632 tokens (262,144 positions), 128 generated this commit 36.55 tok/s 41.84 tok/s 3.20 (runs of 4) 16.7 / 58.9 ms

At 261,632 with runs of 8 (4c9637ed and earlier builds): 30.2 tok/s, slower than plain; runs of 3: 33.2. Served at 262,144 (lexi-engine, the Fibonacci request at temperature 0, prompt included; 394bb21b): 42.3 tok/s without the draft head, 49.5 with it, the same answer.

At 524,288 positions (2026-11-21, code of the controllers / prompt-attention commit; prompt p523264.ids: the engine's source text of the 262,144 prompt followed by 34 Panel source files, 523,264 tokens; r524k10.ids: the same length with ten planted facts at 1%, 10%, ..., 80%, 99%):

Measurement Result
Load (runner, passes of 2,048) weights 17.62 GB, caches 5.02 GB, scratch 0.58 GB, 13.1 s
Prompt 523,264 tokens (bench) 682.6 s = 766.6 tok/s
Generation at depth 523,264, 64 tokens 33.71 tok/s (29.25 ms a token)
Retrieval, ten facts (ask) 10 of 10; that prompt 690.2 s = 758.1 tok/s
Draft head (spec, passes of 1,024, 2.00 GB) speculative 32.07 tok/s against 31.09 plain with the draft loaded (3.37 tokens a step; proposing 26.3 ms, verifying 78.0 ms); identical to plain greedy
Served (lexi-engine -c 524288, greedy chat, 1,143 tokens, prompt included) 43.9 tok/s without the draft head (passes of 2,048), 51.0 with it (the plan takes passes of 1,024); the same answer

In that commit the draft head did not beat plain decoding without it at this depth (32.1 against 33.7 tok/s): its own attention over the whole context cost about 26 ms a step. Version 3a376f8: 47.0 tok/s against 37.3 plain in the same run. Commands: LEXI_INKLING_CONTEXT=524288 LEXI_INKLING_CHUNK=2048 LEXI_INKLING_PROMPT_RUNS=1 inkling_vulkan bench GGUF p523264.ids 64; LEXI_INKLING_CONTEXT=524288 inkling_vulkan ask GGUF r524k10.ids 8; LEXI_INKLING_DRAFT=src LEXI_INKLING_CONTEXT=524288 LEXI_INKLING_CHUNK=1024 inkling_vulkan spec GGUF p523264.ids 128.

Commands for the e2184ab5 row: LEXI_INKLING_CHUNK=2048 inkling_vulkan bench GGUF pN.ids 64 (two prompts, the second warm), and LEXI_INKLING_CONTEXT=262144 LEXI_INKLING_CHUNK=2048 LEXI_INKLING_PROMPT_RUNS=1 inkling_vulkan bench GGUF p261632.ids 64 (load: weights 17.62 GB, caches 2.60 GB, scratch 0.58 GB, 12.9 s).

Retrieval at depth (runner mode ask, e2184ab5 and again 394bb21b, 2026-11-21): five facts ("the access code for vault NAME is NNNNNN") planted at 2%, 25%, 50%, 75% and 97% of a 261,120-token prompt at 262,144 positions, then asked back one after another as plain text: 5 of 5 answered exactly (the same with an 8,192-token prompt). A second prompt with ten facts at 1%, 10%, 20%, ..., 80% and 99% of 260,864 tokens (the commit after 394bb21b): 10 of 10 answered exactly. Again with the prompt attention in registers and 32 queries a workgroup (this commit): 10 of 10, the 260,864-token prompt in 230.1 s (1,133.6 tok/s).

Typed decisions (2c0f15fe kernels plus the decision commit, 2026-11-21):

LoRA (synthetic rank-16 adapter from inkling-lora-synth, scale 1, 2026-11-21): device against the reference with the same adapter, 48 positions one at a time, unrounded caches: KL 0.00000, the same top token throughout; the binary16 prompt kernels (16-token passes) against it: KL 0.00018; the adapter's own effect against the base model KL 0.00095 (same top 97.92%). A zero adapter (B = 0) gives output bitwise equal to the base, single tokens and 16-token passes (4-bit caches). Cost with a 4,096-token prompt (one cold prompt per process): prompt 1,843.9 tok/s against 2,042.2 without (-9.7%), generation 44.29 against 43.94 (no measurable cost). Served with --lora at 262,144 positions: /health lists the adapter with its SHA-256, and the chat answer is unchanged in form (reasoning and content separated).

Host recording against replay (runner mode replay-ablation, 64 decode steps at one position, each step's command buffers either recorded as usual or replayed from a recording): at 4,096 positions 22.42 ms a step recorded, 19.25 ms replayed (22.38 recorded again); at 16,384: 22.92 / 19.84 / 22.93. About 3.1 ms a token (14%) is host-side command recording: the size of the gain available from recording a token's whole forward once. With the recorded forward (position word and replay, the commit after the decision commits): 128 generated tokens at 4,096 positions 50.25 tok/s (43.54 recording every token), at 16,384 49.12 (42.47), the generated ids identical, logits bitwise equal.

Per-token work, 2026-11-21 evening, each change alone against the same baseline in one binary (switches; 4-bit caches; 128 generated tokens after a 4,096 / 16,384-token prompt, one cold prompt per process; accuracy = 4-bit run against the vendor reference, 510 rows, single tokens / 16-token passes):

Change (switch) Generation 4k / 16k Prompt 4k / 16k Accuracy Kept
none (baseline) 50.36 / 49.12 tok/s 2,004 / 1,884 tok/s 0.00419 / 0.00351
controllers in two commands per set (FUSED_CONTROL) 52.31 / 50.89 2,101 / 1,973 0.00428 / 0.00343 yes
mix and norm in one command per token 50.18 / 48.73 2,018 / 1,896 bitwise equal no (slower)
per-token expert loops unrolled 50.10 / 48.63 2,004 / 1,887 bitwise equal no (slower)
one-token history updates folded into cache-row and branch commands 50.38 / 49.10 2,005 / 1,886 bitwise equal no (no gain)
matrix-core prompt attention, sums in registers (ATTN_REGACC) unchanged 2,094 / 1,975 0.00419 / 0.00359 yes
8-bit inputs to the 4-bit experts (W4A8, with the unrolled loop) 52.81 / 51.37 unchanged 0.00372 / 0.00351 option, off
the attention projections of one input in one command (bitwise equal) 1.0 ms a token slower unchanged bitwise equal no (slower)
32 queries a workgroup in prompt attention (ATTN_Q32, on top of the kept ones) unchanged 2,245 / 2,148 against 2,200 / 2,070 16-token passes unaffected yes

The 8-bit input rounding alone (LEXI_INKLING_INPUT8, same kernels): 0.00419 none, 0.00385 experts, 0.00371 projections, 0.00384 all: no measurable cost. W4A8 cannot pass the arithmetic check (KL 0 against the CPU reference with unrounded caches): against the reference rounding the same inputs (inkling-reference --inputs q8) it gives KL 0.00024 at 48 positions and 0.00094 at 1,024, and two device paths that differ only in the rounding formula differ by 0.00052, because an input that differs in its last bit flips a value at a rounding boundary by a whole step and the loop carries it. So it stays off by default. At 261,632 positions REGACC takes the prompt from 878.2 to 959.9 tok/s (297.9 -> 272.6 s; the generated tokens after the prompt differ, the sums being added in another order).

The 2c0f15fe kernels at 16,384 tokens (2026-11-21, development A/B in one session, single prompt per process): prompt 1,573.5 tok/s and generation 37.35 tok/s, against 1,409.8 and 32.69 with the earlier kernels switched back on; the 64 generated tokens identical.

llama.cpp 29b52d398 + patch on the same file and card (llama-bench -ngl 99 -fa on -ctk q4_0 -ctv q4_0 -b 2048 -ub 512, 2026-11-20, a disk copy running beside it): prompt 425 / 397 tok/s at 4,096 / 16,384, generation 25.4 / 25.0. At 262,144 it loads (about 22.3-22.9 GB on the card plus 3.9-4.5 GB reported in system memory) but did not finish a 261,632-token prompt in 55 minutes (two passes, llama-bench) nor a 129,374-token prompt in 45 minutes (one pass, llama-cli, -c 131072); no rate exists for it at depth.

11. Known limits (2026-11-21)

12. Image input: the encoder and projector (2026-11-23, joined and checked on the device 2026-11-24)

What a picture becomes

The checkpoint's 422 model.visual.* tensors (BF16, 636.5 MB) are a 23-layer vision transformer of width 1024 and a two-step projector into the text model's width. A picture becomes one row of 2,304 values per cell of 40 x 40 pixels (a 20-pixel patch, merged 2 x 2), the cells in raster order, no separator rows. The prompt holds one <|unused_200054|> token per cell after <|content_image|>, as its own message block; the rows take the place of those tokens' embeddings and do not pass the embedding norm (every other position does).

Stage Arithmetic
Canvas The picture at its own size at the top left of whole cells (a partly covered cell counts). Pixels outside the picture hold the raw value -1, so after the rescale they are (-1/255 - 0.5) / 0.5 = -1.0078, not black.
Pixels value / 255, then (x - 0.5) / 0.5, per channel.
Transparency RGBA is laid over a checkerboard of 8-pixel squares, 204 (top left) and 153, rounded to nearest, before anything else.
Too large More than 103 x 103 cells (a 4,096-pixel square, the largest side the model card names): both sides rounded to whole cells; if still over, each side becomes floor(side / beta / 40) cells with beta = sqrt(width x height / (10,609 x 1,600)), at least one; the picture is resampled to that size (Lanczos-3).
Patches Each 20 x 20 x 3 square (row, column, channel order) times patch_embedding [1024, 1200], no bias.
Positions position_embedding is a 32 x 32 table; it is resampled to the picture's patch grid (bilinear, pixel centres aligned, ends clamped) and added. A 640 x 640 picture uses it as stored.
Class row class_embedding + cls_position_embedding, in front of the patch rows. Then ln_pre (LayerNorm, eps 1e-5).
23 layers LayerNorm; q, k, v with biases; 16 heads of 64; rotary positions on q and k in two dimensions: pairs 0-15 of a head turn by (column + 1) x 10000^(-j/16), pairs 16-31 by (row + 1) x 10000^(-(j-16)/16), the class row at (0, 0); softmax(q.k / 8); output projection with bias, times ls_1, added; LayerNorm; 4,096-wide MLP with biases and exact (erf) GELU, times ls_2, added. No final norm.
Join The class row is dropped; each cell's four patch rows are joined top left, top right, bottom left, bottom right (4,096 values).
Projector proj_in [4096, 4096], GELU, proj_out [2304, 4096]; neither has a bias.

The cell bound is the one of the two rules we read that follows the vendor's stated input range (40 to 4,096 pixels a side). llama.cpp bounds a picture at 4,096 cells instead (its own limit on image tokens, with the same arithmetic); --max-cells 4096 gives that plan. The bound is a field of the configuration, not a memory budget: the reference's attention takes its queries in blocks, so a large picture costs time, not a score matrix of patches squared.

Code and tools

crates/model-inkling/src/vision.rs holds the configuration (vision_config plus the processor's fields, each checked), the planning, the encoder (Vision::encode, all cores through the same product the text reference uses) and the pack function. Reference::final_hidden_with_rows runs the text model on a sequence where given positions take given rows; those rows skip the embedding norm.

inkling-vision-reference CHECKPOINT_DIR IMAGE OUT [--gguf FILE] [--compare DUMP] [--max-cells N] [--taps DIR] [--patch-half]
inkling-vision-reference --compare-files ROWS DUMP
inkling-vision-pack SOURCE.gguf CHECKPOINT_DIR OUT.gguf
inkling-reference CHECKPOINT_DIR IDS OUT --rows POSITION:ROWS[,POSITION:ROWS...]

A runtime that sums a file's tensors as weights has to leave vision. tensors out of the text model's plan, as it does for draft..

Check against llama.cpp (1f8baae, CPU backend, 2026-11-23)

The comparison projector file is made by llama.cpp's own converter (convert_hf_to_gguf.py SRC --mmproj --outtype f32); its rows come from a small driver over its library (mtmd_tokenize, mtmd_encode_chunk) with the text model loaded vocabulary-only, flash attention off, CPU only, dumped with MTMD_DEBUG_EMBEDDINGS. Five pictures: one cell exactly (40 x 40), a size that needs padding on both sides (333 x 217, 9 x 6 cells), a 640 x 480 page with glyph-like edges (16 x 12 cells), a 200 x 120 picture with transparency (5 x 3 cells) and a 1000 x 700 picture whose patch grid (50 x 36) is wider than the position table (25 x 18 cells).

Picture Rows F32 file, as we compute F32 file, our patch product in half precision BF16 file
40 x 40 1 2.2e-4 7.1e-7 3.4e-3
333 x 217 54 2.1e-4 7.4e-7 3.7e-3
640 x 480 192 9.0e-4 2.0e-6 9.1e-3
200 x 120, transparency 15 6.8e-4 1.3e-6 5.7e-3
1000 x 700 450 3.8e-4 1.6e-6 not run

Figures are the relative L2 distance of all rows (|ours - theirs| / |theirs|). The lowest cosine of a row pair is 1.000000000 in the third column, 0.99996589 in the second and 0.99891 in the last. Single runs.

Rows in the text model (CPU, vendor checkpoint)

One prompt, 34 tokens: the effort line, a user block <|content_image|> with four placeholder tokens (an 80 x 80 picture), a user block "What colour fills this picture? Answer with one word.", then <|message_model|><|content_text|>. inkling-reference SRC ask.ids - --rows 12:ROWS with the rows of three solid pictures:

Picture Top next token (logit) Second
red (220, 20, 20) Red (26.98) red (24.61)
blue (20, 40, 220) Blue (26.04) blue (23.47)
green (20, 180, 40) Green (26.20) green (23.01)
no rows (the placeholder tokens' own embeddings) The (25.65) Blue (23.58)

So the rows carry the picture into the text model when they replace the placeholder embeddings without the embedding norm. This is the yardstick a device runtime's picture prompts are scored against (same ids, same rows).

The pack tool was run on a small real source (the 0.64 GB comparison projector file) with the real checkpoint: 422 tensors added, a second pack refused, and the reference's rows from the packed file equal the checkpoint's byte for byte for two pictures. It has not been run on a model file yet.

Unit tests (cargo test -p lexi-engine-model-inkling --lib, 26 pass): configuration, planning (cells, padding, bound, strips), pixel order and padding value, checkerboard, position taps (identity on the 32 x 32 grid, clamped ends), rotary angles, erf and GELU, LayerNorm, join order, the rows entry of the text reference, and a pack round trip on a small synthetic file and checkpoint (source preserved, shapes, same rows from either source, second pack refused).

The server's encoder against the reference (2026-11-24)

int-ivs-join.sh tower (job i1124-021): the server's own call into the encoder, on a file packed with the tower, gives rows bitwise equal to inkling-vision-reference for all six test pictures (1 to 450 cells, RGB and RGBA): 9,216 / 2,304 / 124,416 / 34,560 / 442,368 / 1,036,800 of as many values.

The llama.cpp patch (llama.cpp-29b52d398-inkling2.diff)

Changes to llama.cpp (MIT) commit 29b52d398; apply with git apply. The official build b12722 reads the NVFP4exp-Q8 file without it.

Patches to llama.cpp 29b52d398 ("model : Inkling 2 Mini", build 12600), MIT licensed upstream code, used to
convert Inkling-2-Mini with its experts on the vendor's 4-bit grid and to run that file as the comparison baseline.
Apply with: git -C llama.cpp checkout 29b52d398 && git -C llama.cpp apply llama.cpp-29b52d398-inkling2.diff
See ../runtimes/INKLING-2-VULKAN-20261121.md, section 8.

diff --git a/conversion/inkling2.py b/conversion/inkling2.py
index 63e73a6d5..599c864ed 100644
--- a/conversion/inkling2.py
+++ b/conversion/inkling2.py
@@ -12,6 +12,8 @@ import torch
 if TYPE_CHECKING:
     from torch import Tensor
 
+import os
+
 from .base import LazyTorchTensor, ModelBase, MmprojModel, TextModel, gguf, logger
 
 
@@ -158,6 +160,38 @@ class Inkling2Model(TextModel):
                 raise ValueError(f"Inkling2: {name}_scale: unsupported stored block shape {block}")
             if list(block) != config.get("weight_block_shape"):
                 logger.warning("Inkling2: %s: hf_quant_config.json weight_block_shape %s conflicts with stored weight/scale shapes %s/%s; using %s", name, config.get("weight_block_shape"), tuple(tensor.shape), ss, list(block))
+            if nvfp4 and os.environ.get("INKLING2_NATIVE_NVFP4") == "1":
+                # Local addition: keep the packed experts on their own grid. The 4-bit values and the E4M3 scale per
+                # 16 values are repacked into ggml's NVFP4 blocks unchanged; the per-expert factor amax / denominator
+                # goes into the per-expert scale tensor the MoE step applies.
+                amax_t, den_t = (LazyTorchTensor.to_eager(self.model_tensors[n]()) for n in companions[1:])
+                den = float(den_t.float().item())
+                packed = LazyTorchTensor.to_eager(tensor).view(torch.uint8)
+                scales = LazyTorchTensor.to_eager(scale_tensor).view(torch.uint8)
+                if bool(((scales & 0x80) != 0).any()) or bool(((scales & 0x7F) == 0x7F).any()):
+                    raise ValueError(f"Inkling2: {name}_scale: negative or NaN E4M3 scale, cannot keep as unsigned")
+                blocks = []
+                for e in range(experts):
+                    w, sc = packed[e], scales[e]
+                    if w13:
+                        # stored rows alternate gate and up; the fused tensor holds the gate rows, then the up rows
+                        w, sc = torch.cat([w[0::2], w[1::2]]), torch.cat([sc[0::2], sc[1::2]])
+                    raw, _ = self._nvfp4_pack(w, sc)
+                    blocks.append(raw)
+                merged = np.stack(blocks, axis=0)
+                target = name.replace(".w13_weight", ".gate_up_proj").replace(".w2_weight", ".down_proj")
+                new_name = self.map_tensor_name(target, try_suffixes=()) + ".weight"
+                logger.info(f"Repacked {new_name} natively as NVFP4, shape [{experts}, {rows}, {cols}]")
+                self.gguf_writer.add_tensor(new_name, merged, raw_dtype=gguf.GGMLQuantizationType.NVFP4)
+                self._write_scales_tensor(new_name.replace(".weight", ".scale"), [float(a) / den for a in amax_t.float().tolist()])
+                # Inputs of these products stay at full precision unless INKLING2_A4=1 (4-bit inputs in the backend
+                # gave garbage with this file on Vulkan, 2026-11-20).
+                if os.environ.get("INKLING2_A4") != "1":
+                    self._prec_a4[new_name] = False
+                del blocks, merged
+                for n in [name] + required:
+                    del self.model_tensors[n]
+                continue
             amax = denominator = None
             if nvfp4:
                 amax, denominator = (self.model_tensors[n] for n in companions[1:])
diff --git a/src/llama-graph.cpp b/src/llama-graph.cpp
index 269b920fb..833696ca8 100644
--- a/src/llama-graph.cpp
+++ b/src/llama-graph.cpp
@@ -1897,7 +1897,7 @@ ggml_tensor * llm_graph_context::build_lora_mm_id(
 
     prec_policy.apply(res);
 
-    if (w->type == GGML_TYPE_NVFP4) {
+    if (w->type == GGML_TYPE_NVFP4 && getenv("LLAMA_NVFP4_ACC_F32") == nullptr) {
         ggml_prec_set_acc(res, GGML_PREC_BF16);
     }
 
diff --git a/src/llama-model.cpp b/src/llama-model.cpp
index 4c77f6f68..0971c27a5 100644
--- a/src/llama-model.cpp
+++ b/src/llama-model.cpp
@@ -2006,6 +2006,19 @@ bool llama_model_base::load_tensors(llama_model_loader & ml) {
                 layer.nextn.shared_head_head_in_s = create_tensor(tn(LLM_TENSOR_NEXTN_SHARED_HEAD_HEAD, "input_scale", i), {1}, TENSOR_NOT_REQUIRED);
             }
         }
+
+        // local fix: cache slots that share a physical layer's expert tensors (looped models) were copied before
+        // the scales above were loaded, and no scale tensor carries their slot index: share the scales as well
+        for (int i = 0; i < n_layer_all; ++i) {
+            for (int j = 0; j < i; ++j) {
+                if (layers[j].ffn_down_exps && layers[j].ffn_down_exps == layers[i].ffn_down_exps) {
+                    if (!layers[i].ffn_up_exps_s)   { layers[i].ffn_up_exps_s   = layers[j].ffn_up_exps_s; }
+                    if (!layers[i].ffn_gate_exps_s) { layers[i].ffn_gate_exps_s = layers[j].ffn_gate_exps_s; }
+                    if (!layers[i].ffn_down_exps_s) { layers[i].ffn_down_exps_s = layers[j].ffn_down_exps_s; }
+                    break;
+                }
+            }
+        }
         // output scales
         if (output) {
             // weight scale