AMQL turns LLMs into a queryable graph database — encode a checkpoint into a VINDEX3 container, then probe token relationships, trace causal pathways, edit weights, generate LoRA adapters, merge models, prune layers, and export back to a standard checkpoint. Built in C# against .NET 11.0 with an optional CUDA backend and a WPF desktop GUI.
This project includes the AMQL inference runtime, which is a high performance generic runtime able to support various models and dynamically sized multi-model and job inference and training clusters across both Windows and Linux.
It also provides a complete, C# .NET managed runtime model training platform, with no external dependencies and no Python code in the training or inference pathway.
AMQL is the model-introspection engine and inference service behind a continuous-cognition platform. It exposes the internal structure of a language model as a graph so you can query how tokens relate, find the edges that carry one concept into another, and then edit those edges — by patching weights, generating a LoRA adapter, or rewriting the base model.
At the token level you can remove false associations or add new ones in a familiar form (e.g. "PlaceA is the capital of PlaceB"). At the next layer of abstraction you can adjust relationships that haven't been described linguistically but are inferred — hallucinations, incorrect tool selection, biases introduced during post-training.
Blending models via consensus-gated token alignment adds solution-space vectors from one model into another. Combined with automated self-learning, this extends a model's understanding beyond what fine-tuning alone can achieve — because fine-tuning is inherently gated at human-level textual representations.
This tool also makes it possible to compile and graft AI programs, which are deterministic solutions written in a language called Entail. This avoids the need for training for specialised subjects and solutions and also avoids inherent problems with traditional training mechanisms.
For example, it's possible to write an Entail program and graft it into a model to support an 8MB context length for specific tasks, with no post-training overhead, or to add support for calculator quality maths support. We provide a set of pre-created scripts that can be grafted to any model to add various capabilities.
# Create a tiny demo model, encode it, and generate a few tokens
amql-cli synth-model demo-model
amql-cli encode demo-model --out demo-container
amql-cli generate demo-container --prompt "The capital of France is" --tokenizer demo-model --steps 8
# Probe a token relationship
amql-cli route demo-container France Paris --tokenizer demo-model --top 5Prerequisites: .NET 11.0 SDK and Git.
AMQL is nine projects with a CLI front-end and a WPF desktop GUI:
| Project | Purpose |
|---|---|
Amql.Cli |
CLI (amql-cli) — encode, infer, patch, merge, inspect |
Amql.Gui |
WPF GUI — container browser, command launcher, parameter editor, tensor explorer |
Amql.Vindex3 |
Container graph, schema, token-index management |
Amql.Safetensors |
Safetensors I/O, MXFP4, ternary, and NVFP4 codecs |
Amql.Inference |
Inference engine, tracing, LoRA adapter execution |
Amql.Hf |
HuggingFace checkpoint loading, config parsing, architecture mapping |
Amql.Merge |
Model merging, MoE-ification, fine-tuning, pruning, model conversion |
Amql.Entail |
The Entail language: statements compiled into model weights |
Amql.Onnx |
ONNX graph builder — zero-dependency protobuf writer |
Amql.Gguf |
GGUF v3 converter for llama.cpp deployment |
AMQL/
├── src/
│ ├── Amql.Cli/ Amql.Gui/ Amql.Safetensors/
│ ├── Amql.Vindex3/ Amql.Inference/ Amql.Hf/
│ ├── Amql.Merge/ Amql.Onnx/ Amql.Gguf/
├── native/amql_cuda/ # CUDA backend (GEMM, dequant, elementwise, attention, cuSOLVER)
├── tests/Amql.Tests/ # 293 unit & integration tests
└── docs/ # Design docs and architecture reference
amql-cli encode <model-dir | https://huggingface.co/owner/name | owner/name> --out <container-dir> [--revision R]
amql-cli bootstrap <model-dir> --source <transformers-src> [--endpoint <url>] [--encode <container-dir>]
amql-cli download <https://huggingface.co/owner/name | owner/name> [--out <dir>]
amql-cli verify <container-dir>
amql-cli generate <container> --prompt "text" --tokenizer <dir> [--steps N (default: until an end token)] [--patch <file>]
[--trace] [--trace-tensors] [--weights f32|bf16|mxfp4]
amql-cli route <container> <A> <B> --tokenizer <dir> [--top N] [--patch <file>]
amql-cli path <container> <A> <B> [--topk N] [--max-nodes N]
amql-cli inspect-token <container> <token> [--neighbors N] [--tokenizer <dir>]
amql-cli change-tensor <container> <object> <tensor> <cell> (--set V|--add V) --out <patch>
amql-cli save-lora <patch> --out <dir> [--rank 8] [--alpha 16]
amql-cli export <container> --out <dir> [--patch <file>] [--quant mxfp4|ptq1|pq2] [--arch qwen4-next]
amql-cli import <container> <model> --out <dir> [--container]
amql-cli merge <containerA> <containerB> --out <dir>
amql-cli moe-ify <container> --out <dir> --text <corpus> [--experts 8] [--top-k 2]
amql-cli prune <container> --out <dir> --target-bytes <size> [--approach provenance|corpus|random|star-elastic] [--text <corpus.txt>]
amql-cli strip <container> --keep Q4_0|BF16|FP4|Q8_0|FP32 [--out <slim-dir>]
amql-cli fine-tune <container> --data <pairs.tsv> --out <patch> [--lr 1e-4]
amql-cli bake-predicate <container> --predicate "<rule>" --out <patch> [--prompts <file>] [--layers 6,9,12]
amql-cli distil <direction|ablate|refuse|probe|steer|fact|sharpen|…> <container> … --out <patch>
amql-cli distil <check|copy|protect> <container> … [--patch <file>]
amql-cli distil <lens|drafter|loop-depth> <container> (--text <corpus> | --prompts <file>)
amql-cli entail oracle <container> --adapter <dir> --out <traces> then: distil oracle <container> --traces <traces> --out <patch>
amql-cli memory build <container> --text <corpus-or-dir> --out <pack>
amql-cli swe-bench run --endpoint <url> --model <id> [--task <ids>] --out <dir>
amql-cli entail compile <program> --out <dir>
amql-cli entail graft <program> --host <dir> --out <dir>
amql-cli entail adapter <program> --tokenizer <partner-dir> --out <dir>
amql-cli entail side <container> --adapter <dir>[,<dir>] --prompt <text>
amql-cli create-model --hidden 768 --layers 12 --vocab 32000 --out <dir>
amql-cli convert-to-classifier <container> --num-labels N --out <dir>
amql-cli convert-to-embedding <container> --out <dir>
amql-cli export-onnx <container> --out <model.onnx>
amql-cli classify <container> --premise "A" --hypothesis "B"
amql-cli layers <container>
amql-cli to-gguf <checkpoint-dir> --out <file.gguf>
amql-cli from-gguf <file.gguf> --out <container-dir>
amql-cli export --list-architectures
Two directory types appear throughout: containers (<container-dir>, encode output,
weights only) and checkpoints (--tokenizer, the original HF model directory whose
tokenizer.json converts text to ids).
Import and export these checkpoint formats:
| Family | model_type |
Notes |
|---|---|---|
| Qwen 3.5–3.8 | qwen3_5_text |
Hybrid: GDN (linear attention) + softmax, MoE, vision |
| Qwen Flash-Next | qwen4_exp_text |
--arch qwen4-next export with HC placeholders |
| Gemma 4 | gemma4_text |
Dense and MoE (26B A4B) models on the GPU engine, with images, drafter and tool calls (docs); E2B and E4B are refused by name |
| LFM 2.5 | lfm2 |
Short-convolution layers + GQA, SwiGLU MLP |
| LFM3 / LFM3-VL | lfm3 |
Gated short conv (width 7) + full and sliding-window GQA, per-head output gate, sandwich norms, zero-tail partial rope; to-gguf writes llama.cpp's lfm3 arch |
| Masked diffusion (dLLM A2D) | a2d-qwen3 |
Qwen3 with bidirectional attention, MDLM objective; generate runs the block-wise low-confidence unmasking sampler; to-gguf writes llama.cpp's rnd1 arch (dense FFN as one expert) for llama-diffusion-cli |
| Nomic Embed | nomic_bert |
Bidirectional encoder, mean pooling |
| ModernBERT / Von | modernbert |
Global + sliding bidirectional encoder, GeGLU; Von's option_marker.pt scoring head read and written natively, and run in-process by decide |
| Jev Classifier | *ForSequenceClassification |
Score head on decoder backbone |
| Binary/Ternary | any decoder | Via --quant mxfp4, --quant ptq1, or --quant pq2 |
Four weight working-set modes, selected by AMQL_WEIGHTS (or --weights on generate, entail eval and entail side):
| Mode | Resident size | Description |
|---|---|---|
f32 |
f32 values; a BF16-stored matrix is held as its BF16 bits and widened in the kernels | Byte-exact reference |
bf16 |
Stored BF16, widened on access into LRU cache | ~2× smaller |
mxfp4 |
MXFP4 packs dequantised into LRU cache | ~4× smaller |
disk |
Only what fits the cache; the rest is widened from the container on every pass | Exact f32 on the CPU for a model larger than RAM |
With the CUDA backend built (native/amql_cuda/build-cuda.cmd) and a CUDA device present,
DecodeSession runs a whole sequence on the device engine. Weights are uploaded once as BF16,
activations, the KV cache and the recurrent state stay on the GPU, and each decode step is one
CUDA graph. On Qwen 3.5 0.8B (RTX 5090) it decodes at ~655 tok/s against llama.cpp's ~440–500
on the same weights in F16, and prefills 512 tokens at ~64k tok/s against ~21k. Prompts round
their activations to BF16 for the tensor cores, so logits agree with the managed path to ~0.3%;
AMQL_GPU_PREFILL=f32 (or DecodeSession.ExactGpuPrefill) keeps them at f32, agreeing to
rounding, at about half the prompt speed. Decode steps are f32 either way. Routed experts, short convs, traces and patches stay
on the managed path; see docs/gpu-performance.md.
When AMQL_GPU=1 and the CUDA backend is built (native/amql_cuda/build-cuda.cmd),
MXFP4 packs are dequantised to FP16 on-device and GEMMs run on tensor cores with FP32
accumulate. Elementwise ops — RMSNorm (auto-dispatched), SiLU, RoPE — and fused
GQA attention (QKᵀ + causal mask + softmax + PV) also run on-device. KV caches can
be allocated and appended on-device with zero host round-trips. Embeddings, norms,
and the output head stay f32 in every mode (in disk, only while they fit the cache). A cuSOLVER fp64 Cholesky path accelerates
merge normal-equation solves.
On AMD GPUs the same backend builds with HIP (ROCm) into amql_hip.dll / libamql_hip.so:
native/amql_cuda/build-hip.cmd (Windows, AMD HIP SDK plus Visual Studio's C++ workload) or
build-hip.sh (Linux, ROCm). AMQL picks an NVIDIA GPU, else an AMD one, else the CPU, and a
dedicated GPU before an integrated one; amql-cli gpus lists them and --gpu-device amd:1 (or
AMQL_GPU_DEVICE, or Studio's device list) picks another. Both libraries build from the same
sources, and each is loaded only on a machine that uses its maker's GPU. The kernels assume 32-lane warps, so it targets RDNA GPUs (gfx10xx and later). NVIDIA-only pieces
have portable stand-ins: the NVFP4 tensor-core GEMM falls back to FP16 tiles, and the tiled
attention's mma.sync is emulated with shuffles. See docs/hip.md.
Tune memory with AMQL_MEMORY_GB, AMQL_F32_CACHE_GB, and AMQL_CORES.
amql-cli bench <container> measures single-request prefill and decode speed once the model is
loaded, and prints a checksum of the logits' bit patterns so a change to the kernels can be shown
not to change the numerics. On Qwen 3.5 0.8B (CPU, Threadripper 9970X, two DDR5 channels) decode
runs at ~44 tok/s against llama.cpp's ~39 on the same weights in F16; see
docs/cpu-performance.md.
entail graft and encode stream: they read the host through its memory map and write each tensor as
it is made, so neither holds a model in memory, and a sharded host (model.safetensors.index.json)
grafts like a single file. entail eval and entail side switch to disk by themselves when a
graft's f32 weights would exceed the memory budget. It never uses the GPU, so GPU memory isn't a limit either.
route names the relationship between two tokens using template probing and identifies the
exact (layer, head, position) attention coordinates carrying one token's meaning into the
other. Causal tracing then reports per-layer residual weights — the targets to patch or LoRA.
path shows the model's own continuation route between two tokens via bidirectional
best-first search over the next-token graph.
change-tensor edits a single weight cell and records the delta as a patch. Every
command (generate, route, path, inspect-token, export) accepts --patch to
apply deltas at load time. save-lora factors a patch's 2-D deltas into a LoRA adapter
(lora_A / lora_B) via truncated SVD.
fine-tune performs supervised output-head adaptation: for each (prompt, completion)
pair, the model forward-passes the prompt, teacher-forces each completion token, and
accumulates per-token head deltas — no autograd, no gradient infrastructure, fully
deterministic.
train is full-parameter training with reverse-mode autograd, written in C# and CUDA with no
Python: the model is built from the same operation plan the runtime serves (embeddings, norms,
softmax and gated delta-rule attention, short convolutions, dense FFNs, the head) and every
operation has an exact backward on the CPU and on the GPU, checked against finite differences.
AdamW, gradient accumulation and clipping, warm-up and cosine schedules, and layer recomputation
are built in. Checkpoints are written only between optimiser steps, atomically; Ctrl+C, a PAUSE
file or --max-minutes stop the run at the next such point, and --resume continues it exactly.
The result is a weight patch for --patch, or a baked container. See Training.
bake-predicate writes a rule into the weights — "always reply in French", "you are
a pirate", a fact the model should take as given. The model reads the predicate in
context (as its system message) and answers a set of probe prompts, which it can write
for itself; then the FFN down-projections of a few middle layers are solved in closed
form (minimum-norm ridge, layer by layer) so the model without the predicate
reproduces its hidden states with it. The output is an ordinary weight patch, and the
run reports KL and top-1 agreement against the predicated model before and after.
distil is the family of edits made by calculation from the model's own activations, each written
as an ordinary weight patch. See Distillation.
- Directions and probes.
distil direction/probefind the direction that separates two sets of prompts, with held-out accuracy;ablate,refuseandsteerremove it, add it under conditions, or scale it. - Facts.
distil factwrites a batch of facts into the attention output projections in one joint closed-form solve, and reports each fact, its paraphrases and its neighbours before and after. - Checking an edit.
distil checkruns one suite (copying names in view, expected answers, drift from the unpatched model, a few reasoning problems) and gives one table and one exit code.distil protectrewrites any patch so the matrices it edits no longer move what a keep set feeds them. - A program as teacher.
entail oraclerecords every token an Entail program decided beside the model;distil oraclefits those decisions into the weights, so the model makes them alone (an Entail program as teacher). - Measuring before building.
distil lensshows how early the model's next token can be read;distil drafterfits a drafter for a model that ships none;distil loop-depthshows what a looped model would choose with fewer or more passes;distil sharpensearches attention scales at a chosen context length (long-context editing).
Most of these were added recently and are unit-tested but not yet measured on models; each doc section says what has been measured.
entail is the deterministic counterpart: a small language in which each statement
compiles to specific weights, with nothing learned or fitted. compile turns a program
into a new, empty model; graft restructures a Qwen3.5 checkpoint around it, in lanes the
host cannot touch. scripts/entail/mathematics.entail.txt defines decimal arithmetic:
grafted into Qwen 3.5 0.8B it takes direct arithmetic from 43.8% to 100% with top-1
predictions on prose unchanged. See docs/entail.md.
entail find, extract, optimise, review and accept go the other way: from a trained
model to a subject's Entail. They locate the experts or neurons that carry a subject, probe
what the model does, and refine the resulting table into exact laws through documented
rewrite rules, with any model able to propose a change and a mechanical gate deciding.
From Qwen 3.5 0.8B's own noisy answers this derived a + b, a - b and a*b, and reloading
the result took it from 84% to 100% on unseen two-digit arithmetic.
entail decompile writes down what a model's neurons do across a whole corpus, unrelated
trained-in material included, as the raw state before optimisation, and entail fidelity
measures it. For Python on the same model that is 1.8 million rule lines. See
docs/entail-optimisation.md.
A subject can also be synthesised: a new program, built with vocabulary from the model and the extract, that turns a request into code. For a slice of Python on the same model it took unseen requests from 14 of 26 to 20 of 26, with the derivation still written by hand. See docs/entail-synthesis.md.
Physics and chemistry have laws of their own. physics.entail.txt states the algebra of units,
so 12 kg * 3 m/s^2 = gives 36 N, and chemistry.entail.txt gives molar masses and checks that
equations balance. Grafted into the same model they got 192 of 196 and 182 of 182 test cases right
on notation they can read, against 12 and 104 before, but changed no chat reply, because the model
writes its working in LaTeX. See docs/entail-sciences.md.
A program can also run beside a model rather than inside it. entail adapter builds one for a
model's tokenizer and entail side runs them together: the program reads every token in doubles
and rules on the next one at the sampler, so the model is never changed and keeps its own precision.
Four programs beside the same model matched their grafts, in about 1 MB instead of 14.4 GB, and left
its prose loss identical. See docs/entail-adapter.md.
Dates, number bases, boolean logic and JSON are rule systems too. Grafted into the same model, dates went from 54 to 250 of 250 test cases, bases from 41 to 315 of 315, logic from 45 to 217 of 218 and JSON verdicts from 217 to 370 of 370. A JSON guard rules out any token that would break a text as it is written, which kept 60 of 60 unfinished texts valid against 38. No chat answer got better, and Qwen's native tool calls are XML, so the guard helps JSON output rather than those. See docs/entail-formal.md.
merge— Two models into one via consensus-gated token alignment. Shared tokens that agree are blended and the result restored to full energy; disagreements keep the scaffold's row. The larger model scaffolds the stack shape.import— Merge a second model into an existing container.moe-ify— Turn a dense model into a routed Mixture of Experts by clustering FFN co-activations. No training, quality gated by perplexity.prune— Shrink a container to a byte budget. Two pruners share the command: layer drop (provenance/corpus/random) removes whole decoder layers, andstar-elasticdoes structured width pruning — it ranks the FFN intermediate channels by activation magnitude (Σ|x·W_upᵀ|, the Star Elastic importance score) on one forward pass over--text, then slices gate/up/down to the top channels on every dense layer (homogeneous width). No elastic training, so quality is gated, not recovered — seedocs/star-elastic-pruning.md.strip— Produce a slim single-encoding copy of any container. Strips every representation that doesn't match--keep, yielding a container withAuthority: Slimthat's roughly the size of the equivalent GGUF. The output is a fully self-describing VIndex3 container —verify,generate,export, andimportwork on it directly.create-model— New container with Xavier-uniform random weights and a user-defined architecture. Ready forfine-tune.convert-to-classifier— Add a random score head to a generative model.convert-to-embedding— Add pooling facts; no new tensors.
export --quant writes an HF checkpoint in a reduced-precision weight format:
| Flag | Format | Bits/Weight | Scheme |
|---|---|---|---|
--quant mxfp4 |
MXFP4 (OCP) | ~4.0 | FP4 E2M1, E8M0 block scales, 32-element blocks |
--quant ptq1 |
PTQ1_0 (Bonsai type 143) | ~1.75 | 5 trits/byte (base-3 dense), FP16 scale, 128-block, Hadamard |
--quant pq2 |
PQ2_0 (Bonsai type 142) | ~2.13 | 2 bits/trit, FP16 scale, 128-block, Hadamard |
All three quantise stack projections only; embeddings, norms, and the output head stay
full precision. ptq1/pq2 produce PrismML Bonsai-compatible checkpoints for use with
the PrismML llama.cpp fork — those 142/143 ids are the fork's own numbering, not upstream
ggml's (stock ggml ternary is TQ1_0 = 34 / TQ2_0 = 35 with a different trit packing).
to-gguf converts an exported checkpoint into a GGUF v3 file for llama.cpp / LM Studio,
quantising with AMQL's own encoders rather than shelling out to llama-quantize. Each
encoder mirrors the corresponding quantize_row_*_ref in ggml-quants.c byte for byte:
--quant |
Tensor types | general.file_type |
|---|---|---|
none / f16 |
F16 weights, F32 norms and scalars | 1 (mostly F16) |
q4_0 |
Q4_0 (18 B / 32 values) | 2 (mostly Q4_0) |
mxfp4 |
MXFP4 (17 B / 32 values, ggml type 39) | 38 |
mxfp4_moe |
llama.cpp's MXFP4_MOE recipe: 3-D MoE expert stacks in MXFP4, every other quantizable weight in Q8_0 | 38 |
In every mode norms, embeddings, the output head, MoE routers and all 1-D tensors stay full
precision, matching llama-quantize's skip list. A chat_template.jinja in the checkpoint
is embedded as tokenizer.chat_template; without one the run reports the GGUF as
completion-only.
export-onnx produces a standard .onnx model using only built-in operators (no custom
ops). Includes full RoPE (dynamic cos/sin tables), RMSNorm from primitives, SiLU, and
scaled dot-product attention with mask. Compatible with ONNX Runtime 1.21+.
amql-gui is the desktop app for running models locally. Tick the containers to serve, whether chat,
embedding, classifier or decision models, set how much RAM and GPU memory they may use with two sliders, and
press Start. The app starts amql-server with them behind one OpenAI-compatible endpoint, and shows its
state on every page. It finds amql-cli and amql-server by itself, so there is nothing to configure first.
Advanced settings stay out of the way until needed. See AMQL Studio.
The Server page: the containers found on disk, each with its kind read from its system graph, two chat models chosen and the server running on port 8000.
The Monitor is a live view of the server, not a log: four requests generating across two models, output speed and GPU use over the last five minutes, per-model totals, and the recent requests with time to first token and decode speed.
Import from Hugging Face encodes a checkpoint from a folder on disk or straight from the Hub: paste a
model's URL (or owner/name), and it is downloaded (resumable, SHA-256 checked) and encoded into a container
ready to serve.
The Playground streams a chat with any loaded model, showing speed and token counts under each reply. It
can also send raw requests to any endpoint. Tools puts every amql-cli command (98, subcommands included)
behind a searchable form, with required fields first, the rest under Advanced, memory sliders for the CLI's
--max-ram / --gpu-memory, and a run history.
The Explorer on a Qwen3.5-0.8B container: index facts, then the primary-text component's per-layer attention
policy (linear_attention and softmax alternating on a 4-layer interval) above the object graph (embedding,
decoder stack, final norm, output head, vision tower, MTP drafter). Tensors open in a value grid.
amql-server --model <container> [--model …] serves containers over HTTP: TypeSafe /v1/decisions for Von
decision models, and OpenAI-compatible /v1/embeddings, /v1/chat/completions, /v1/responses
(streaming included, with the model's own chat template, tools, reasoning and previous_response_id), and
/v1/classify for classifier containers — each endpoint only where the container can serve it.
--adapter runs Entail adapters beside a chat model, so an agent harness can use the model with, for
example, stop-circling. See Server.
For agent loops and answers it also has, each off by default and described in the server doc:
- Agent rules: a guard against repeated calls, a stall rule (
--stall-rule), a check before a turn ends after a change (--check-before-finish), and tool arguments held to values already in the conversation (--seen-values). - Decoding: contrastive context decoding (
--contrast), which favours what the context adds over what the model remembers; fork and vote (--vote), several answers from one piece of reasoning; n-gram packs and memory packs (--memory-pack), knowledge from a corpus looked up by the model's own state; a thinking budget. - Looped models:
--loop-iterationsruns the loop fewer or more times than trained (depth ops).
amql-cli swe-bench drives any OpenAI-compatible endpoint through C# coding tasks in a sandbox
(swe-bench).
amql-cli decide <von-container> --request @request.json answers a TypeSafe /v1/decisions request —
choice, score and noul questions over one state — with a Von decision model, on an in-process
ModernBERT encoder written in C#. The output is the API's response body (--envelope jevai for
jevai.org's { code, message, data }), identical to the Von SDK's on the real weights. See
Decision Models.
generate --trace-json trace.json records every operator of every generated token — output
magnitude, timing, which experts a MoE layer routed to, and the resulting top-k with entropy
and top-1 margin. Opening that file in Explorer → Inference Visualiser (or running
amql-gui --trace trace.json) draws the forward pass as a zoomable map: one column per
layer, operators in computation order, edges thickened and coloured by activation, and a
violet tab on any operator that reads exactly one weight tensor.
An 8-step run of Qwen3.5-0.8B, aggregated over all steps. Layer columns carry their
operators in computation order, coloured cool-to-hot by mean activation — the
linear-attention linear_qkv projections dominate, and linear_qkv at layer 18 is
selected at 100% intensity with its editable weight reference
(target.decoder_stack / 18.linear_attn.in_proj_qkv.weight) shown at top right. The
ranking lists weight-bearing operators by mean magnitude; the logit lens shows the eventual
token capital only emerging from layer 19 onward; the attention panel gives one sparkline
per head for the six softmax layers, the other eighteen being recurrent and having no
attention matrix.
The map is meant to be acted on, not just read:
- Run a prompt from the window (
▶ Run…) and watch the map fill in as each token completes. Inference runs in a CLI child process and the window tails its stream, so the model is never loaded into the GUI and stopping a run kills the process rather than unwinding a thread. From the Explorer tab, ▶ Run and display inference… (header button, right-click menu, or Explorer → Run and Display Inference…) does this in one step: it opens the run dialog with the loaded container filled in and a visualiser that fills in live. - Rank operators by mean/peak activation or time, filtered to weight-bearing ones.
- Scrub a single step, or view the aggregate over the whole run.
- Right-click a weight node to copy the
edit-tensorcommand that scales or zeroes that whole tensor, and thegenerate --patch … --trace-json …command that re-runs with it. - Compare two traces: the map recolours on a diverging ramp showing which operators got louder (red) or quieter (blue) after the edit.
Three overlays answer questions activation magnitude cannot:
--attribute --attribute-corrupt <text>runs ROME-style causal attribution — corrupt one prompt token, restore each layer's clean residual in turn, re-measure the target's probability. Colouring by causal share shows what actually mattered rather than what was loud. Per layer, not per operator, and one extra forward per layer.--logit-lensprojects each layer's residual through the output head, showing the depth at which the prediction forms. Costs a head GEMM per layer per step.--trace-attentionrecords each softmax head's weights for the last query row. Recurrent layers produce none, and the panel says so rather than leaving them to look missing.
edit-tensor is the whole-tensor counterpart to change-tensor; a single-cell edit to a
multi-million-element matrix is too small to measure downstream. See
docs/inference-visualiser.md.
| Variable | Default | Purpose |
|---|---|---|
AMQL_WEIGHTS |
f32 |
Weight working-set: f32, bf16, mxfp4, or disk |
AMQL_GPU |
0 |
Enable CUDA GPU acceleration |
AMQL_MEMORY_GB |
auto | Total memory budget for LRU cache |
AMQL_F32_CACHE_GB |
¼ of budget (½ for disk) |
F32 cache cap |
AMQL_CORES |
auto | CPU core budget for parallel work |
AMQL_GPU_ENGINE |
1 |
0 keeps sessions off the device engine (the managed path then runs, with per-operator CUDA offload where enabled) |
AMQL_GPU_PREFILL |
bf16 |
f32 runs the device engine's prompt projections as FP32 SGEMM and its prompt attention without TF32, so prompts agree with the managed path to f32 rounding instead of ~0.3% |
AMQL_RESIDENT_BF16 |
1 |
0 widens BF16 matrices to f32 at load in the f32 mode instead of keeping their BF16 bits (same results, twice the memory traffic) |
AMQL_MERGE_GPU |
0 |
Enable GPU-accelerated merge GEMM |
- VIndex3 Overview — container format, schema, segment layout
- System Architecture — layered design, component responsibilities
- Flash-Next Export — qwen4-next architecture mapping
- Classifier Models — Jev/NLI classification design
- Embedding Models — nomic-bert encoder
- Decision Models — Von (ModernBERT option-marker) import/export
- AMQL Studio — the desktop app: serving models, the monitor, playground and tools
- Inference Visualiser — operator trace format and the map UI
- Entail — compiling statements into weights: design and results
- The Entail Language — language reference
- Extracting and Optimising a Subject — the cycle, its rewrite rules and the reviewer's brief
- Synthesising a Subject — from an extract to a program that answers requests, step by step
- Physics and Chemistry — the algebra of units, molar mass and conservation of mass, with results and limits
- Dates, Bases, Logic and JSON — the calendar, number bases, truth tables and a JSON guard, with results and limits
- Bootstrapping an architecture — a model family this build has not seen, from its Python source read as text
- Distillation — edits by calculation: directions, probes, facts, checks and protection
- An Entail program as teacher — a program's decisions fitted into the model it ran beside
- Server — endpoints, tool calls, agent rules, decoding options, packs
- GPU Performance — the engine, speculative decoding, drafters, 4-bit weights
- KV Cache and Context Extension — paging, formats, long contexts
- Long-Context Editing — attention sharpness at long context
- Depth Ops — looped models and loop depth
- N-gram Packs and Memory Packs — knowledge beside the weights
- swe-bench — the coding benchmark
- All documents
- CUDA Backend Plan — GPU kernel roadmap
- MTP Drafter — speculative decoding drafter design
Credit for the VIndex3 design: Chris Hay.
See CONTRIBUTING.md for guidelines. The project is research-status (pre-1.0) — issues and PRs welcome, expect the surface to evolve.



