Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
89 commits
Select commit Hold shift + click to select a range
6bd8bc9
feat: honor ignore_merges in the BPE tokenizer for o200k-style vocabs
baptisterajaut Nov 21, 2026
9620ae9
feat: inkling2 engine (strata-ink2) and reference path for Inkling-2-…
baptisterajaut Nov 21, 2026
3c7c297
feat: inkling2 oracle checks and stop-gap OpenAI shim
baptisterajaut Nov 21, 2026
52736e2
refactor: address inkling2 experts through per-slot pointer tables
baptisterajaut Nov 21, 2026
1f24ead
feat: inkling2 expert offload to pinned RAM with a device-side LRU (-…
baptisterajaut Nov 21, 2026
2fabb8a
feat: inkling2 DSpark drafter and greedy speculative decoding (--spec…
baptisterajaut Nov 21, 2026
a858056
perf: inkling2 small-T verify kernels (multi-vector GEMVs, grouped ex…
baptisterajaut Nov 21, 2026
e51853c
feat: inkling2 exact sampled speculative decoding, graph-captured ver…
baptisterajaut Nov 21, 2026
a4e207f
fix: inkling2 spec verify with --tc 0 and under expert offload, fallb…
baptisterajaut Nov 21, 2026
5050dca
feat: serve Inkling 2 from the Strata server (reply markers, tool cal…
baptisterajaut Nov 21, 2026
f0e1f75
fix: forced tool_choice in Inkling 2 form (call header and JSON opening)
baptisterajaut Nov 21, 2026
5c86c8d
feat: inkling2 cold experts on the CPU (--cpu-threads), NUMA-placed e…
baptisterajaut Nov 21, 2026
ea559aa
perf: inkling2 CPU experts: lighter visit sync, opt-in int8 activatio…
baptisterajaut Nov 21, 2026
f292ef0
feat: inkling2 STRATA_NUMA_POOL=0 turns the CPU experts NUMA placemen…
baptisterajaut Nov 21, 2026
5bfe4af
perf: inkling2 expert placement by decayed use counts (misses most us…
baptisterajaut Nov 21, 2026
ae362a7
perf: inkling2 CPU experts: vpermps NVFP4 decode, prefetch, fused Swi…
baptisterajaut Nov 21, 2026
5f65029
perf: inkling2 PCIe share of CPU misses, sized per visit from the mea…
baptisterajaut Nov 21, 2026
1096428
fix: inkling2 CPU expert memory bound to its NUMA node, a node full o…
baptisterajaut Nov 21, 2026
6532963
perf: inkling2 NVFP4 expert GEMVs read x through L1, SwiGLU once in g…
baptisterajaut Nov 21, 2026
a16b281
chore: inkling2 validation tools take the checkpoint and work dirs as…
baptisterajaut Nov 21, 2026
bd8c108
merge: upstream main into feat/inkling2
baptisterajaut Nov 21, 2026
b76b43a
inkling2: --kv k8v4 (int8 K, rotated 4-bit V); Turing: the fp32 promp…
merbanan Nov 21, 2026
cbbb95d
perf: inkling2 decode attention keeps k8v4 V loads out of the f16 loo…
baptisterajaut Nov 21, 2026
85af06a
inkling2: --kv k8v8 (int8 K, Hadamard-rotated int8 V)
merbanan Nov 21, 2026
db6849d
inkling2: offload margin 384 -> 128 MiB (INK2_OFF_MARGIN_MIB), the po…
merbanan Nov 21, 2026
b48000c
docs: inkling2 offload margin comment: what the 128 MiB covers, measu…
baptisterajaut Nov 21, 2026
dec6a1e
inkling2: load GGUF files (llama.cpp's merged inkling2_loop layout), …
merbanan Nov 21, 2026
334c0bc
fix: inkling2 GGUF refuses --cpu-threads and --spec (no GGUF kernels …
baptisterajaut Nov 21, 2026
7d38454
inkling2: --kv-grow (the full-attention K/V grows into the expert pools)
merbanan Nov 21, 2026
81ac409
fix: inkling2 --kv-grow pool shrink drops planned CPU-expert promotio…
baptisterajaut Nov 21, 2026
35edb12
inkling2: elastic prompt buffers and staging (--kv-grow with offload)…
merbanan Nov 21, 2026
b63b0a3
fix: inkling2 elastic prompt buffers stay fixed under --spec (its ver…
baptisterajaut Nov 21, 2026
e4377d3
inkling2: short prompts fetch only their routed experts (the routed-p…
merbanan Nov 21, 2026
7e088eb
fix: inkling2 routed short prompts only when the pools hold all their…
baptisterajaut Nov 21, 2026
e17673d
inkling2: big prompt chunks decode each GGUF expert once and run cuBL…
merbanan Nov 21, 2026
2f83ddb
fix: inkling2 decode-once GGUF scratch allocated only for a GGUF mode…
baptisterajaut Nov 21, 2026
6561346
inkling2: long contexts on a small card: the prompt chunk shrinks to …
merbanan Nov 21, 2026
569185f
fix: inkling2 chunk fit counts the staging as the routed-prompt guard…
baptisterajaut Nov 21, 2026
a06ff78
inkling2: dense Q8 GEMV with 16-byte loads (INK2_Q8_WIDE, default on)…
merbanan Nov 21, 2026
48febba
perf: inkling2 GGUF defaults from 3090 measurements: decode-once from…
baptisterajaut Nov 21, 2026
955c8c0
feat: inkling2 conversation cache for --serve: prompt-end checkpoints…
baptisterajaut Nov 21, 2026
5a63687
feat: inkling2 DONE line reports drafts accepted / offered and the pr…
baptisterajaut Nov 21, 2026
b884394
docs: inkling2 conversation cache: no host name in a comment
baptisterajaut Nov 21, 2026
6bbc06f
perf: inkling2 conversation cache: parked rows in power-of-two pinned…
baptisterajaut Nov 22, 2026
af8424b
docs: inkling2 conversation cache: the live checkpoints are not evict…
baptisterajaut Nov 22, 2026
51c5048
fix: inkling2 conversation cache: a conversation being parked counts …
baptisterajaut Nov 22, 2026
4888bf6
fix: inkling2 conversation cache: branch points between conversations…
baptisterajaut Nov 22, 2026
a58cbeb
fix: inkling2 accepts --conversation-cache-slots from Strata configs …
baptisterajaut Nov 22, 2026
7524ae7
feat: inkling2 image input in strata-ink2 (ViT + projector in the eng…
baptisterajaut Nov 21, 2026
fdb2095
feat: serve sends Inkling 2 pictures to strata-ink2 as image= files (…
baptisterajaut Nov 21, 2026
c1207fc
fix: Inkling 2 JPEGs reach strata-ink2 as Pillow-decoded BMP (the ref…
baptisterajaut Nov 21, 2026
eb52e7f
test: inkling2 picture comparison tools (embeddings, multimodal KL), …
baptisterajaut Nov 21, 2026
d3a98a1
docs: inkling2 vision CBA notes (attention at the cap, weights over P…
baptisterajaut Nov 21, 2026
bd533db
fix: inkling2 refuses pictures over 134 MP before decoding them; head…
baptisterajaut Nov 21, 2026
5415261
test: vision_kl.py --together (several pictures in one prompt)
baptisterajaut Nov 22, 2026
cb64c66
feat: inkling2 pictures in the conversation cache: image tokens keyed…
baptisterajaut Nov 22, 2026
078c290
fix: inkling2 thinking off from enable_thinking / Anthropic disabled …
baptisterajaut Nov 21, 2026
ea09d1b
feat: setup installs Inkling-2-Mini (pinned checkpoint, strata-ink2 b…
baptisterajaut Nov 21, 2026
369c7c4
fix: inkling2 setup sizes the offload for small cards (context and re…
baptisterajaut Nov 21, 2026
98c34c2
fix: inkling2 offload sizing counts the VRAM in use and keeps a slack…
baptisterajaut Nov 21, 2026
a8918c9
fix: setup needs CMake 3.25.2 for the engine CUDA20 targets (3.25.1 c…
baptisterajaut Nov 21, 2026
cfcdd1a
fix: inkling2 start message gives its own RAM figure (measured 16.8 G…
baptisterajaut Nov 22, 2026
4539d3b
feat: inkling2 offload configs use --kv-grow with the longest context…
baptisterajaut Nov 22, 2026
24edc26
fix: inkling2 --kv-grow keeps each expert pool at its minimum: prompt…
baptisterajaut Nov 22, 2026
dddda83
feat: inkling2 offload keeps --chunk 1024 and uses i8r (closest 8-bit…
baptisterajaut Nov 22, 2026
dfdf9f4
fix: inkling2 offload sizing counts the prompt buffers a 1024-chunk c…
baptisterajaut Nov 22, 2026
2daf740
feat: inkling2 setup turns pictures on and sizes the conversation cac…
baptisterajaut Nov 22, 2026
dd7fa18
docs: inkling2 engine flags and their measured effect (docs/INKLING2.md)
baptisterajaut Nov 22, 2026
d99e5fa
feat(inkling2): add AMD ROCm/HIP engine support for strata-ink2 and s…
jingx8885 Nov 22, 2026
bc4a937
feat(terminal): enable Inkling-2-Mini setup and HIP engine build on A…
jingx8885 Nov 22, 2026
ddc6038
fix(tests): expect ink2_build HIP flags in test_gh_0217_hipflags
jingx8885 Nov 22, 2026
83a97d8
feat: inkling2 on AMD ROCm/HIP wave32 RDNA (#16 by jingx8885)
baptisterajaut Nov 22, 2026
01f7da1
fix: inkling2 HIP targets on Linux only and out of the default HIP bu…
baptisterajaut Nov 22, 2026
3cbc56b
feat: inkling2 GGUF experts may use one type for layers 0-19 and anot…
baptisterajaut Nov 22, 2026
1f0a0a1
docs: inkling2 GGUF files with a second expert type in layers 20-23, …
baptisterajaut Nov 22, 2026
f2af205
docs: inkling2 --spec greedy output can part from plain decoding at a…
baptisterajaut Nov 22, 2026
454cb91
chore: merge upstream 0.2.19, the official Inkling checkpoint source …
baptisterajaut Nov 22, 2026
81267cc
docs: inkling2 verify products follow decode GEMVs, not decode attention
baptisterajaut Nov 22, 2026
2cea839
fix: keep the official Inkling source out of the catalog table of SQ …
baptisterajaut Nov 22, 2026
41b610c
test: inkling2 offload floor reads pool_slot, pins allow a checkpoint…
baptisterajaut Nov 22, 2026
cad508f
fix: strata-ink2 configs get no --parallel, no Vision shard and a mod…
baptisterajaut Nov 22, 2026
f30718f
fix: /props says strata-ink2 keeps earlier reasoning when its templat…
baptisterajaut Nov 22, 2026
6e237c7
feat: strata-ink2 --spec 1 runs with --cpu-threads, a verify block's …
baptisterajaut Nov 22, 2026
5ae3b0d
feat: inkling2 setup keeps --spec 1 beside the expert offload where t…
baptisterajaut Nov 22, 2026
d3431b1
docs: strata-ink2 --spec 1 with --cpu-threads, measured per card
baptisterajaut Nov 22, 2026
7516ee8
chore: merge upstream 0.2.20, the official Inkling checkpoint keeps i…
baptisterajaut Nov 23, 2026
3f746d1
feat: strata-ink2 --verify-tc 1, the small-T dense products of the sp…
baptisterajaut Nov 23, 2026
2ced29e
feat: strata-ink2 takes a numeric reasoning effort, 0.0 to 0.99, as I…
baptisterajaut Nov 23, 2026
bb137fd
docs: strata-ink2 --verify-tc 1 measured on an RTX 3090, and the nume…
baptisterajaut Nov 23, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
134 changes: 134 additions & 0 deletions docs/INKLING2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
# Inkling-2-Mini (`strata-ink2`)

`strata-ink2` is Strata's engine program for [Inkling-2-Mini](https://huggingface.co/thinkingmachines/Inkling-2-Mini)
(Thinking Machines Lab, Apache 2.0): a 128-expert, top-8 mixture of experts whose layers 6-17 run three times, so a
token goes through 48 layer applications. The engine reads the published checkpoint as it is: NVFP4 experts in layers
0-19, MXFP8 experts in layers 20-23, BF16 for everything else, and the ViT that reads pictures. Nothing is requantized.

To install and start it, see [MODELS.md](MODELS.md#inkling-2-mini): `./setup.sh --family inkling2` (the official
checkpoint, one of the two sources of setup's Inkling family; the `.strata` SQ builds run `strata-inkling` instead)
picks the flags below for your card. This page is for reading what setup chose, or for running the engine by hand.

NVIDIA (RTX 20 series or newer) or AMD RDNA (wave32, gfx10 to gfx12) through ROCm, one GPU, Linux. The AMD port is
jingx8885's, measured on a gfx1151 (Radeon 8060S); the speeds below are NVIDIA ones.

## What setup chooses

Measured on an RTX 3090 with its VRAM limited to the card size (the expert pools only see that much), 2x Xeon Gold
6252, 257-token chat prompt, 512 greedy tokens; prompt speed on a 16K-token prompt.

| Card | Engine flags (besides `--model`, `--chunk 1024 --tc 1`) | Decode | Prompt |
| --- | --- | --- | --- |
| 24 GB | `--max-context 65536 --kv f16 --spec 1` (every expert on the card) | 88-90 tok/s (108 on short prompts with `--spec`) | 2,380 tok/s |
| 16 GB | `--max-context 131072 --kv f16`, offload as below | not measured | not measured |
| 24 GB, longer contexts | `--max-context 131072 --kv f16 --kv-grow 1 --vram-reserve-mib R --cpu-threads N --spec 1` | 84-86 tok/s (103 on short prompts) | not measured |
| 12 GB, with a desktop | `--max-context 65536 --kv f16 --kv-grow 1 --vram-reserve-mib R --cpu-threads N` | 73-75 tok/s | 717 tok/s |
| 8 GB, nothing else on it | `--max-context 32768 --kv f16 --kv-grow 1 --vram-reserve-mib R --cpu-threads N` | 66 tok/s | 568 tok/s |
| 8 GB, with a desktop | the same with `--kv i8r` | 60-61 tok/s | 560 tok/s |

Every config also gets `--conversation-cache-mib 4096` (2048, or off, when RAM is short). In offload the engine pins
about 17 GiB of RAM for the experts that are not on the card; setup asks for 32 GB of RAM.

With the offload, setup adds `--spec 1` only where the card still holds 70% of the experts beside the drafter at the
full context. The drafter takes about 2 GiB from the expert pools (its weights, its K/V, and the prompt buffers, which
stay mapped with it), and a check computes eight tokens' experts to keep three to five, so the experts that are not on
the card cost more per token than in plain decoding. Decode in tok/s, plain and with `--spec 1` (same box, 512 greedy
tokens, mean of two runs; 16 GB: one run):

| Card and context | Experts on the card with the drafter | Chat prompt (257 tokens) | Short prompt (24 tokens) |
| --- | --- | --- | --- |
| 8 GB, 32K | 19% | 66.9, with `--spec 1` 51.8 | 64.6, with `--spec 1` 59.9 |
| 12 GB, 64K | 45% | 80.6, with `--spec 1` 72.3 | 81.5, with `--spec 1` 87.9 |
| 16 GB, 128K | 70% | 84.1, with `--spec 1` 84.4 | 85.7, with `--spec 1` 100.2 |
| 24 GB, 128K | 98% | 85.9, with `--spec 1` 83.9 | 86.7, with `--spec 1` 103.1 |
| 24 GB, 256K, `--kv i8r`, no `--kv-grow` | 92% | 82.9, with `--spec 1` 84.7 | 83.3, with `--spec 1` 100.0 |

These are speeds at the start of a conversation: with `--kv-grow` the K/V of a long conversation takes expert slots,
which is why the 16 GB card at 128K stays without the drafter.

## Flags

**Model and context**

- `--model DIR` the checkpoint folder (or a GGUF file, below).
- `--max-context N` (alias `--ctx`) the longest conversation, prompt plus answer.
- `--chunk N` prompt tokens read per step (`--serve` needs one; setup uses 1024). With `--kv-grow` a chunk shrinks by
itself when the card is short of room.
- `--tc 0|1` tensor cores for the prompt (1, the default in setup). `--tc 0` is the exact fp32 path, slower, used to
check the other one.
- `--serve` the line protocol the Strata server speaks.

**Memory**

- `--vram-reserve-mib N` leaves N MiB of VRAM free and turns on the expert offload: the experts that do not fit stay
in pinned RAM, and the card keeps the most used ones (decayed use counts, promotions in the background).
- `--cpu-threads N` computes the experts that are not on the card on the CPU instead of copying them over PCIe: one
pool of N threads per NUMA node (at most two), each expert's memory bound to its node. Needs `--vram-reserve-mib`,
AVX2 + FMA + F16C, and Linux. `STRATA_NUMA_POOL=0` turns the NUMA placement off.
- `--kv-grow 1` the K/V cache starts small and grows into the expert pools as the conversation grows, so a long
context costs expert slots only when it is used. Each pool keeps at least 64 slots: a prompt that would need more
ends with a "context is full" error, and the engine keeps serving. `--kv-grow-step N` sets the growth step.
- `--kv FORMAT` the K/V format. Mean KL against fp32 K/V (expert routing fixed, 23K-token mixed text):

| `--kv` | Bytes per token and layer pass | KL mean | Top-1 |
| --- | --- | --- | --- |
| `f16` (default) | 4,096 | 0 | 100% |
| `i8r` (int8, rotated) | 2,112 | 3.5e-5 | 99.80% |
| `k8v8` | 2,112 | 5.3e-5 | 99.73% |
| `i8` | 2,112 | 1.3e-4 | 99.61% |
| `k8v4` | 1,632 | 1.5e-3 (1.6K-token text) | 98.75% |

`f32` exists for checks.

**Speed**

- `--spec 1` speculative decoding with the model's own drafter (`mtp.safetensors`): a draft token is kept only when it
is the model's own choice (greedy) or passes the usual acceptance test (sampled). It falls back to plain decoding
while that is faster. The check reads the drafts through other kernels than plain decoding, so a near-tie can go the
other way: a 512-token greedy answer matched plain decoding for 273 tokens, then parted where the top two logits were
0.2 apart. With `--cpu-threads` the CPU also computes a check's experts that are not on the card (same answer as
with every expert on the card over those 512 tokens); it pays only where most experts are on the card (the table
under [What setup chooses](#what-setup-chooses)).
- `--verify-tc 1` (off by default) runs the dense products of a `--spec` check and of the drafter (up to 8 vectors,
matrices of more than 256 rows) on tensor cores: fp16 weights and inputs, fp32 accumulation, the numbers of the
prompt path's products. Without it, those products follow plain decoding's order. CUDA cards of compute capability
8.0 or later. RTX 3090, every expert on the card, `--kv i8r`, a check at every step, three runs each: 36.0 ms per
check without, 32.6 with. With the expert routing fixed, the 8-token prompt lane is at mean KL 3.0e-7 against the
fp32 token path, against 8.7e-8 without the flag, top-1 100%.

**Conversations and pictures**

- `--conversation-cache-mib N` (0, off, by default) keeps conversations in pinned RAM so that a request never reads
again a prompt the engine already read: a checkpoint at the end of each prompt lets the next turn continue from
there even when the client sends the history back without the model's reasoning, conversations set aside (an
agent and its subagents taking turns) are taken up again, and conversations sharing a long beginning (a system
prompt and tools) read it once. `--conversation-cache-min-tokens N` (512): shorter conversations are not kept.
- Pictures need no flag. The ViT is read into RAM at the first picture and streamed to the card for each one, so
text-only use costs no VRAM; with offload it borrows a few hundred MiB of expert slots while it runs. A picture
over `--image-max-tokens N` (4096; one token is a 40x40 pixel tile) is scaled down.

**Checks and debugging**: `--tokens IDS` / `--tokens-file F` with `--n N` run one prompt without the server,
`--dump-logits F`, `--record-routing F` / `--force-routing F`, `--image F`, `--dump-image-emb F`, `--vis-pixels F`.
`terminal/tools/inkling2/README.md` describes the comparison against the transformers implementation.

## GGUF files

`--model FILE.gguf` reads llama.cpp's merged `inkling2_loop` layout with IQ3_S, IQ4_NL and Q8_0 experts (work by
merbanan). GGUF models run without `--cpu-threads` and `--spec` for now, and setup does not install them.
Layers 20-23 may use a different expert type than layers 0-19, as in ggml-org's `Inkling-2-Mini-IQ4_NL.gguf` (IQ4_NL,
Q8_0 in layers 20-23): on the 1,600-token text its mean KL against the fp32 reference is 5.9e-3 (llama.cpp on the same
file: 5.4e-3). Any other mix, or an expert type outside these three (NVFP4, for example), stops the load with an error
that names the layers and types.

## Quality

Against the transformers implementation in fp32 on a 1,600-token text: the token-by-token path with fp32 K/V is at
mean KL 1.4e-12 (top-1 100%), and the tensor-core prompt path at 2.1e-7 with the expert routing fixed. Pictures: mean
KL 1e-7 or less in fp32, with the same greedy answers.

## Limits

- One GPU. `--cpu-threads` on Linux only, at most two NUMA nodes.
- `--spec` with the expert offload and no `--cpu-threads` copies a check's missing experts over PCIe: 16 tok/s on an
8 GB card. Setup does not write that pair.
- Not offered in `strata launch` or the desktop app yet.
53 changes: 53 additions & 0 deletions docs/MODELS.md
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,59 @@ drafting and picture reading (`Inkling-2-Mini-Vision.strata`, 0.64 GB).
strata launch --family inkling-2-mini --model SQ-15
```

### The official checkpoint (`strata-ink2`)

Setup's Inkling family also takes the official checkpoint (`./setup.sh --family inkling-2-mini --model official`,
or `--family inkling2` for short), which runs its own engine, `strata-ink2`; the rest of this section is about it.

[Inkling-2-Mini](https://huggingface.co/thinkingmachines/Inkling-2-Mini) by Thinking Machines Lab (Apache 2.0): a
mixture of experts with 128 experts per layer, 8 active, NVFP4 and MXFP8 experts. Strata reads the published
checkpoint as it is (a 20.2 GB download at a pinned revision, every file checked against its size and SHA-256) with
its own engine program, `strata-ink2`, which setup compiles for your card. NVIDIA cards (RTX 20 series or newer) and AMD RDNA cards (ROCm) on
Linux only so far; it is not in the app or in `strata launch` yet. It reads pictures itself (send them in the chat
page or as `image_url`; nothing is loaded for them until the first one, then about 0.65 GB of RAM). A request's
`reasoning_effort` is the template's thinking level: a word (none 0.0, minimal 0.1, low 0.2, medium 0.7, high 0.9,
xhigh 0.99) or the level itself, 0.0 to 0.99; 0.9 when the request gives none. The model still thinks briefly at
none. Setup also
gives it a conversation cache in RAM (`--conversation-cache-mib`, 4096 or 2048 MiB depending on the RAM left, off
with a note below that): an agent's next turn then reads only what is new, even when the agent drops the model's
reasoning from its history.

```sh
./setup.sh --family inkling2
```

Setup picks how it runs from the card:

- **Every expert fits on the card** (24 GB cards up to a 64K context): they stay there, with the checkpoint's draft
layer (`mtp.safetensors`) for faster answers. Measured on an RTX 3090: 19.3 GiB of graphics memory at an 8K context,
21.2 GiB at 64K; the conversation memory takes 36,864 bytes a token.
- **Otherwise** (8 to 16 GB cards, or a longer context): the card keeps the most used experts and the others stay in
RAM (about 32 GB of RAM; the engine's peak was 16.8 GiB); the CPU computes the experts a token needs that the card
does not hold, one thread per physical core of each CPU socket (`--cpu-threads`, AVX2 needed). The conversation
memory grows into the card as it is used (`--kv-grow 1`) and gives the room back to the experts afterwards.
`--vram-reserve-mib N` keeps N MiB of the card free for other programs (1500 by default on a card that drives a
display, less where the card has no room for it).

The engine keeps at least 64 expert slots of each kind (about 2.5 GB) at every point of a conversation: a long
prompt is read in smaller pieces near that limit, and a prompt that does not fit even then gets a plain error ("the
context is full") while the model keeps running. Setup picks the longest context that never reaches that point,
counting what a desktop already holds on the card, with 16-bit conversation memory where it reaches 32K and 8-bit
(`--kv i8r`, the closest 8-bit format to full precision) where it does not:

| Card | Context | Conversation memory |
| --- | ---: | --- |
| 8 GB, nothing else on it | 32K | 16-bit |
| 8 GB driving a desktop | 32K | 8-bit (`i8r`) |
| 12 GB driving a desktop | 64K | 16-bit |
| 16 GB driving a desktop | 128K | 16-bit |

Measured on an RTX 3090 set up as an 8 GB card with a 500 MiB desktop and 8-bit memory: a 30K-token prompt read
and answered (83 s to the end of the answer's 1,450 tokens), a 55K-token prompt refused with "the context is full"
after 41K tokens, and the next request answered by the same engine.

The run config (`strata-inkling-2-mini-official.json`) holds the engine's arguments; they can be edited there. Every flag and its measured effect: [INKLING2.md](INKLING2.md).

## Adding or switching models

- **In the app:** the Models page lists every model with its size and whether it fits your computer. Pick one and press the install button.
Expand Down
22 changes: 22 additions & 0 deletions engine/cmake/strata_gpu_engine.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,28 @@ if(STRATA_ENABLE_CUDA OR STRATA_ENABLE_HIP)
add_executable(strata-q36ref src/qwen35/q36ref.cu)
target_include_directories(strata-q36ref PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include ${_strata_gpu_include_directories})
target_link_libraries(strata-q36ref PRIVATE strata_kernels strata_warnings ${_strata_gpu_runtime_target})
# NEW-MODELS-PLAN.md T1: Inkling-2-Mini's reference path (the thinkingmachines safetensors as shipped: BF16, NVFP4 and
# MXFP8 experts; one GPU, the model resident, plain kernels), checked against transformers by terminal/tools/inkling2/
# HIP: Linux only (the engine uses POSIX calls) and out of the default target, so a plain HIP build of the other
# engines does not compile it; setup builds it by name
if(STRATA_ENABLE_CUDA OR (STRATA_ENABLE_HIP AND NOT WIN32))
add_executable(strata-ink2ref src/inkling2/ink2ref.cu)
target_include_directories(strata-ink2ref PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include ${_strata_gpu_include_directories})
target_link_libraries(strata-ink2ref PRIVATE strata_warnings ${_strata_gpu_runtime_target})
# T2 engine path for the same family: --serve (engine protocol), chunked prefill (cuBLAS), decode graph captured on
# the per-thread default stream
# ink2_cpu.cpp: cold experts on the CPU (--cpu-threads), Linux x86 (a stub elsewhere)
find_package(Threads REQUIRED)
add_executable(strata-ink2 src/inkling2/ink2_engine.cu src/inkling2/ink2_cpu.cpp src/inkling2/ink2_image.cpp)
target_include_directories(strata-ink2 PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include ${_strata_gpu_include_directories})
target_link_libraries(strata-ink2 PRIVATE strata_warnings ${_strata_gpu_blas_target} ${_strata_gpu_runtime_target} Threads::Threads)
target_compile_options(strata-ink2 PRIVATE
$<$<COMPILE_LANGUAGE:CUDA>:--default-stream=per-thread>
$<$<COMPILE_LANGUAGE:HIP>:-fgpu-default-stream=per-thread>)
if(STRATA_ENABLE_HIP)
set_target_properties(strata-ink2ref strata-ink2 PROPERTIES EXCLUDE_FROM_ALL ON)
endif()
endif()
# the engine path for the same family (serve protocol, prompt chunks, decode graph): src/qwen35/q36_engine.cu, a
# library that `strata` switches to for a qwen35moe model (the family switch at the top of its main) and that
# strata-q36 wraps on its own. Not on gfx906 (#3172, #3271): it calls cuBLAS entry points the wave64 compat layer does
Expand Down
4 changes: 4 additions & 0 deletions engine/include/strata/hip_compat/cublas_v2.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <rocblas/rocblas.h>
#define CUBLAS_COMPUTE_32F rocblas_datatype_f32_r
#define CUBLAS_DEFAULT_MATH 0
#define CUBLAS_PEDANTIC_MATH CUBLAS_DEFAULT_MATH
#define CUBLAS_GEMM_DEFAULT rocblas_gemm_algo_standard
#define CUBLAS_OP_N rocblas_operation_none
#define CUBLAS_OP_T rocblas_operation_transpose
Expand All @@ -21,6 +22,7 @@
#define cublasHandle_t rocblas_handle
#define cublasSetStream rocblas_set_stream
#define cublasSetWorkspace rocblas_set_workspace
#define cublasSgemm rocblas_sgemm
#define cublasStatus_t rocblas_status

inline rocblas_status cublasSetMathMode(rocblas_handle h, int mode) {
Expand All @@ -42,6 +44,8 @@ inline rocblas_status cublasGemmEx(rocblas_handle h, rocblas_operation trans_a,
#else
#define CUBLAS_COMPUTE_32F HIPBLAS_COMPUTE_32F
#define CUBLAS_DEFAULT_MATH HIPBLAS_DEFAULT_MATH
// rocBLAS returns HIPBLAS_STATUS_NOT_SUPPORTED for HIPBLAS_PEDANTIC_MATH and already runs SGEMM in full FP32.
#define CUBLAS_PEDANTIC_MATH HIPBLAS_DEFAULT_MATH
#define CUBLAS_GEMM_DEFAULT HIPBLAS_GEMM_DEFAULT
#define CUBLAS_OP_N HIPBLAS_OP_N
#define CUBLAS_OP_T HIPBLAS_OP_T
Expand Down
11 changes: 11 additions & 0 deletions engine/include/strata/hip_compat/cuda_runtime.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#define cudaDevAttrComputeCapabilityMinor hipDeviceAttributeComputeCapabilityMinor
#define cudaDevAttrIntegrated hipDeviceAttributeIntegrated
#define cudaDeviceGetAttribute hipDeviceGetAttribute
#define cudaDeviceGetPCIBusId hipDeviceGetPCIBusId
#define cudaDeviceCanAccessPeer hipDeviceCanAccessPeer
#define cudaDeviceEnablePeerAccess hipDeviceEnablePeerAccess
#define cudaDeviceDisablePeerAccess hipDeviceDisablePeerAccess
Expand All @@ -35,6 +36,7 @@
#define cudaErrorMemoryAllocation hipErrorOutOfMemory
#define cudaErrorPeerAccessAlreadyEnabled hipErrorPeerAccessAlreadyEnabled
#define cudaErrorStreamCaptureUnsupported hipErrorStreamCaptureUnsupported
#define cudaErrorUnknown hipErrorUnknown
#define cudaError_t hipError_t
#define cudaEventCreate hipEventCreate
#define cudaEventCreateWithFlags hipEventCreateWithFlags
Expand Down Expand Up @@ -112,6 +114,7 @@ hipError_t mem_get_info(size_t* free_bytes, size_t* total_bytes);
#define cudaRuntimeGetVersion hipRuntimeGetVersion
#define cudaSetDevice hipSetDevice
#define cudaStreamBeginCapture hipStreamBeginCapture
#define cudaStreamCaptureModeRelaxed hipStreamCaptureModeRelaxed
#define cudaStreamCaptureModeThreadLocal hipStreamCaptureModeThreadLocal
#define cudaStreamCaptureStatus hipStreamCaptureStatus
#define cudaStreamCaptureStatusNone hipStreamCaptureStatusNone
Expand All @@ -121,6 +124,7 @@ hipError_t mem_get_info(size_t* free_bytes, size_t* total_bytes);
#define cudaStreamEndCapture hipStreamEndCapture
#define cudaStreamIsCapturing hipStreamIsCapturing
#define cudaStreamNonBlocking hipStreamNonBlocking
#define cudaStreamPerThread hipStreamPerThread
#define cudaStreamQuery hipStreamQuery
#define cudaStreamSynchronize hipStreamSynchronize
#define cudaStreamWaitEvent hipStreamWaitEvent
Expand Down Expand Up @@ -165,7 +169,14 @@ inline hipError_t cudaGraphInstantiate(hipGraphExec_t* exec, hipGraph_t graph,
return hipGraphInstantiate(exec, graph, error, log, size);
}
#define __trap() __builtin_trap() // the compiled-out sm_80 paths (never selected on AMD)
#if defined(__HIP_STREAM_PER_THREAD)
#define cudaMemcpyToSymbol(symbol, ...) hipMemcpyToSymbol(static_cast<const void*>(&(symbol)), __VA_ARGS__)
#define cudaMemcpyToSymbolAsync(symbol, ...) hipMemcpyToSymbolAsync(static_cast<const void*>(&(symbol)), __VA_ARGS__)
#define cudaMemcpyFromSymbol(dst, symbol, ...) hipMemcpyFromSymbol(dst, static_cast<const void*>(&(symbol)), __VA_ARGS__)
#else
#define cudaMemcpyToSymbol(symbol, ...) hipMemcpyToSymbol(HIP_SYMBOL(symbol), __VA_ARGS__)
#define cudaMemcpyToSymbolAsync(symbol, ...) hipMemcpyToSymbolAsync(HIP_SYMBOL(symbol), __VA_ARGS__)
#define cudaMemcpyFromSymbol(dst, symbol, ...) hipMemcpyFromSymbol(dst, HIP_SYMBOL(symbol), __VA_ARGS__)
#endif

#include "intrinsics.hpp"
Loading