|
Download README.md from nathaninline/Inkling-2-Mini-NVFP4-Basalt: direct link, hf CLI and curl.
- Browser
- Download file 9.05 kB
-
https://huggingface.co/nathaninline/Inkling-2-Mini-NVFP4-Basalt/resolve/main/README.md
- Command line
-
hf download hf://nathaninline/Inkling-2-Mini-NVFP4-Basalt/README.md
-
curl -L -o README.md https://huggingface.co/nathaninline/Inkling-2-Mini-NVFP4-Basalt/resolve/main/README.md
9.05 kB
| license: apache-2.0 | |
| base_model: | |
| - thinkingmachines/Inkling-2-Mini | |
| base_model_relation: quantized | |
| tags: | |
| - basalt | |
| - nvfp4 | |
| - moe | |
| - quantized | |
| - dspark | |
| - inkling2 | |
| # Inkling 2 Mini NVFP4 for Basalt | |
|  | |
| A [Basalt](https://github.com/jesdga95/basalt) pack of Thinking Machines Lab's [Inkling 2 Mini](https://huggingface.co/thinkingmachines/Inkling-2-Mini) (**26B parameters**, mixture of experts) that fits a **single 16 GB GPU**, plus a small engine patch that keeps it there. All credit for the model goes to Thinking Machines Lab, and for the engine and the original pack ([jesdga/Inkling-2-Mini-Basalt](https://huggingface.co/jesdga/Inkling-2-Mini-Basalt)) to Jesús Gulfo. | |
| ## vs the Unsloth GGUFs: 1.8 to 2.1x faster, closer to BF16 | |
| | | Unsloth [UD-Q3_K_XL](https://huggingface.co/unsloth/Inkling-2-Mini-GGUF) (llama.cpp) | Unsloth [UD-Q4_K_M](https://huggingface.co/unsloth/Inkling-2-Mini-GGUF) (llama.cpp) | **This pack (Basalt)** | | |
| |---|---|---|---| | |
| | **KL divergence vs BF16, mean** | 0.0159 | 0.0073 | **0.0059** | | |
| | KL divergence vs BF16, median | 0.0074 | 0.0035 | **0.0026** | | |
| | KL divergence vs BF16, 99th percentile | 0.155 | 0.061 | **0.053** | | |
| | Same top token as BF16 | 94.4 % | 96.2 % | **96.6 %** | | |
| | Perplexity vs BF16 | +1.43 % | +0.39 % | **+0.26 %** | | |
| | **Decode speed** (same machine) | 49.1 tok/s | 42.0 tok/s | **90.1 tok/s** | | |
| | GPUs used | RTX 5060 Ti | RTX 5060 Ti + RTX 3070 | **RTX 5060 Ti alone** | | |
| | Context | 32K | 32K | **131K** | | |
| | File size | 13.6 GB | 16.6 GB | 17.7 GB | | |
| This pack's figures are with the 8-bit KV cache (`--kv fp8`), the setting used for speed. With the 16-bit cache (`--kv fp16`) it reads **0.0044** mean KLD, 97.2 % same top token and +0.19 % perplexity, for twice the cache memory. | |
| For reference, the official Basalt pack scores 0.0026 mean KLD and 97.8 % same top token (Basalt's own 20-chunk figure), but it does not fit a 16 GB card: on the same RTX 5060 Ti, Basalt keeps about 1,080 of its 3,072 experts in RAM and decodes at **29 tok/s**. | |
| ### How quality was measured | |
| - Reference: the official checkpoint with its experts dequantized to BF16 (`convert_hf_to_gguf --outtype bf16`, llama.cpp `29b52d398`, the commit that added Inkling 2), run through `llama-perplexity --kl-divergence-base`. | |
| - Text: WikiText-2 raw test, 20 chunks of 512 tokens, scored on the second half of each chunk. The base perplexity is **7.6535**, the same as the 20-chunk base on Basalt's [precision page](https://github.com/jesdga95/basalt/blob/main/docs/precision/inkling2.md) (7.6534), so this is the same reference. | |
| - This pack: `basalt-bench --quality 20 --kld-base <base>` (Basalt's own gate: the first half of each chunk is read as a prompt, the second half goes through the decode path). | |
| - GGUFs: `llama-perplexity --kl-divergence-base <base> --kl-divergence` with Unsloth's llama.cpp build (b12588; these GGUFs use the layout from before upstream support), against the same base file, so the same tokens. | |
| - 20 chunks is Basalt's quick gate. The differences between the three quants are several times the standard errors (KLD ± 0.0003 to 0.0004). | |
| ### How speed was measured | |
| RTX 5060 Ti 16 GB (PCIe 4.0 x8) + RTX 3070 8 GB, Ryzen 9 3900X, 46 GB RAM, Linux, CUDA 13.2. Same script for all three: 3 prompts (a story, a Python class with tests, a technical explanation), 400 tokens each, temperature 0.7, reasoning effort `none`, run twice, decode speed after the first token. | |
| | | Runs (story, code, explanation, twice) | | |
| |---|---| | |
| | UD-Q3_K_XL, llama.cpp | 49.4, 49.0, 49.1, 49.0, 49.0, 48.8 | | |
| | UD-Q4_K_M, llama.cpp | 41.9, 41.8, 42.0, 41.9, 42.2, 42.2 | | |
| | This pack, Basalt | 70.8, 117.2, 76.0, 75.3, 117.4, 84.1 | | |
| - Basalt: `--kv fp8 --max-context 131072`, its DSpark drafter on (the default). Drafting pays most on code (117 tok/s) and least on free prose (71 to 84). At temperature 0 the same script averages 95 to 110 tok/s. | |
| - llama.cpp: `-fa on -ctk q8_0 -ctv q8_0 -c 32768 -ngl 99`, Q4_K_M split 0.72 / 0.28 across the two cards. No drafting: the DSpark GGUF made llama.cpp slower on this machine. | |
| - Repeated runs of the Basalt row vary by about 5 to 10 % (the drafts depend on the text). | |
| ## Prompts and long context | |
| Prompt reading on the RTX 5060 Ti, same server as above: | |
| | Prompt | 481 | 2,326 | 7,663 | 18,495 | 45,761 tokens | | |
| |---|---:|---:|---:|---:|---:| | |
| | Read at | 1,731 | 2,514 | 2,707 | 2,337 | 1,995 tok/s | | |
| A 103,019-token prompt is read in about 70 s, a fact hidden in the middle of it is found, and decoding still runs at 52 to 54 tok/s at that depth. | |
| The KV cache is elastic: a short chat leaves its room to the experts, so a larger `--max-context` costs little on short chats (temperature 0.7, same script): | |
| | `--max-context` | 64K | **131K** | 262K | 524K | | |
| |---|---:|---:|---:|---:| | |
| | Short-chat decode | 98.0 | **90.1** | 85.8 | 82.9 tok/s | | |
| A long conversation does take the room it needs (about 16 KiB a token with `--kv fp8`), and the experts it pushes out are then read from RAM. | |
| ## Files | |
| | File | Size | What | | |
| |---|---:|---| | |
| | `Inkling-2-Mini-NVFP4.basalt` | 17.7 GB | the pack (`.basalt` format version 2) | | |
| | `basalt-ajean-inkling.patch` | 56 KB | the engine patch, for Basalt `a11e19f6f` (`git am`) | | |
| | `tools/inkling2_requant.py` | 6 KB | the script that made the pack from the official one | | |
| ## What changed vs the official pack | |
| The official pack keeps the release's NVFP4 experts in layers 0 to 19 and stores the MXFP8 experts of layers 20 to 23 as Q8_0. Its experts take 14.71 GiB, plus 1.10 GiB of dense weights and 0.48 GiB for the drafter: more than a 16 GB card holds. | |
| This pack rounds the experts of **layers 20 to 23 to NVFP4** (tensor scale amax / (6 x 448), one UE4M3 scale per 16 values picked at least squared error, gate and up sharing their tensor scale as in the other NVFP4 layers; mean relative squared error 0.0066). **Every other section is copied byte for byte**: layers 0 to 19, attention, head, embedding, DSpark drafter, vision encoder. The experts drop to 12.81 GiB. | |
| Basalt's precision page had measured this exact choice for layers 20 to 23 (NVFP4 0.00431 KLD vs Q8_0 0.00256, 20 chunks), which matches the 0.0044 measured here with the 16-bit cache. | |
| ## Engine patch for 16 GB cards | |
| The pack also runs on upstream Basalt, but on a 16 GB card upstream still keeps hundreds of experts in RAM, and each one read over PCIe costs speed. Same machine, same script, `--kv fp8`: | |
| | | Experts left in RAM | Decode | First token | | |
| |---|---:|---:|---:| | |
| | Official pack, upstream Basalt (32K context) | 1,077 | 29.4 tok/s | 0.8 s | | |
| | This pack, upstream Basalt `a11e19f6f` (131K) | 870 | 43.6 tok/s | 0.75 s | | |
| | **This pack, patched Basalt (131K)** | **about 60** | **90.1 tok/s** | **0.18 s** | | |
| The patch (5 commits, MIT like Basalt) gives that memory back to the experts: | |
| - prompt chunks of 1,024 rows instead of 4,096 (about 0.7 GiB of buffers less; `AJEAN_PROMPT_CHUNK` restores 4,096) | |
| - the memory estimate's margins as settings (`AJEAN_CARD_SPARE_MIB`, `AJEAN_SHARED_FIXED_MIB`): upstream's were about 0.9 GiB above what this card uses | |
| - an elastic KV cache that starts at 8,192 positions instead of 32,768 and keeps 128 MiB free instead of 512 (`AJEAN_KV_BASE`, `AJEAN_ELASTIC_KEEP_MIB`) | |
| - experts copied back to the card in slabs of 15: alone, each one was rounded up to the driver's 2 MiB pages and **40 % of that memory was lost** | |
| - a prompt chunk takes each RAM expert from its card copy when it has one (first token at 131K: 0.43 s down to 0.17 s) | |
| - the drafter's full-attention layer keeps its last 16,384 positions as a ring (`AJEAN_DRAFT_CTX`): 0.5 GiB back at 131K; only the drafts see less, the output is unchanged | |
| - when the card is full, a new CUDA graph or MMQ buffer gives expert copies back to RAM and retries, instead of stopping the engine | |
| - the server accepts any model name, as llama-server does | |
| Build and run: | |
| ```sh | |
| git clone https://github.com/jesdga95/basalt && cd basalt | |
| git checkout a11e19f6f && git am /path/to/basalt-ajean-inkling.patch | |
| # build as in docs/building.md, for this model only: -DBASALT_MODELS=inkling2 | |
| AJEAN_CARD_SPARE_MIB=128 AJEAN_SHARED_FIXED_MIB=0 CUDA_MODULE_LOADING=EAGER \ | |
| ./bin/basalt serve --model Inkling-2-Mini-NVFP4.basalt --kv fp8 --vision dynamic --max-context 131072 | |
| ``` | |
| On a card of 24 GB or more, upstream Basalt and the official pack are the better choice: everything fits there. | |
| ## Limits | |
| - Tested on one RTX 5060 Ti 16 GB, Linux, CUDA 13.2. Other cards are not tested. | |
| - Images work with `--vision dynamic` (the encoder is in the pack, copied unchanged): it keeps no card memory at rest, and a picture borrows the room of a few expert copies while it is read (191 copies, given back in 65 ms; a 640 x 400 picture and a 174-token answer in 2.3 s). Short-chat decode with it on stays within noise of the figures above. | |
| - Quality is measured on 20 chunks, speed on one machine with one script. | |
| ## License | |
| The model: Apache 2.0, as the base model (`LICENSE`). The patch and the script: MIT, as Basalt. | |