miloserdev's picture
Add Inkling-2-Mini model card, tokenizer, scripts, and quality logs
d190588 verified
|
Raw History Blame Contribute Delete
5.75 kB
metadata
license: apache-2.0
base_model: thinkingmachines/Inkling-2-Mini
library_name: numallama
pipeline_tag: text-generation
tags:
  - inkling
  - inkling2
  - moe
  - q4
  - q8
  - numallama
  - custom-format

Inkling-2-Mini for numallama

Text-only quantized weights of thinkingmachines/Inkling-2-Mini (source revision c9d028302cd0f035fdf8e7e91f089a4ce94d2195, Apache-2.0), packaged for the CPU inference engine numallama.

This is not a GGUF and cannot be loaded by llama.cpp. The files use numallama's INK2JSON container: a JSON manifest plus memory-mappable tensor blobs. Vision, audio and MTP are not included.

Files

File Experts Size Description
inkling_mini_q4.ink2 Q4 17.00 GB default; source NVFP4/MXFP8 dequantized, then Q4
inkling_mini_q8.ink2 Q8 27.71 GB source dequantized, 8-bit experts
inkling2_tokenizer.bin β€” 2.8 MB 201024-entry BPE tokenizer for numallama
source/ β€” β€” upstream config, tokenizer JSON, chat template, generation config
scripts/ β€” β€” exporter, tokenizer converter helper, logits comparison
quality/ β€” β€” oracle/Q4/Q8 logits and the validation log
checksums.sha256 β€” β€” SHA-256 of the containers and tokenizer

Matrices outside MoE are Q8 in both containers. Expert quantization differs: layers 0-19 in the source are NVFP4 and 20-23 MXFP8; the exporter dequantizes them and writes Q4 or Q8 blocks.

Model

Inkling-2-Mini is a 26.4B-parameter model with 3.4B active parameters (5.4B effective with the three loop passes), 24 physical layers, hidden size 2304, 24/8 attention heads, head_dim 128, 128 experts with top-8 routing, a 1024-token sliding window on 20 layers and full attention on layers 5/11/17/23. The loop core is layers 6..17, run three times with separate KV/conv slots (48 slots). Vocabulary: 201024 padded / 200058 unpadded.

Usage

Build numallama (the engine has no external Python/CUDA dependencies at runtime):

git clone https://github.com/miloserdev/numallama
cd numallama
make

Download the container and tokenizer, then generate:

hf download miloserdev/Inkling-2-Mini-numallama inkling_mini_q4.ink2 --local-dir .
hf download miloserdev/Inkling-2-Mini-numallama inkling2_tokenizer.bin --local-dir .

./runq inkling_mini_q4.ink2 -z inkling2_tokenizer.bin \
  -m generate -i "The capital of France is" -n 24 -c 128 -t 0

Chat and the OpenAI-compatible server:

./runq inkling_mini_q4.ink2 -z inkling2_tokenizer.bin \
  -m chat -i "What is the capital of France?" -n 128 -t 0

./runq inkling_mini_q4.ink2 -z inkling2_tokenizer.bin \
  -m server -P 8080 -c 8192

The server supports /v1/chat/completions (streaming and non-streaming), reasoning_content, stop strings, min_p, presence/frequency penalties, seeds and include_usage. It keeps one multi-turn session cache. It handles one request at a time; run replicas behind scripts/replica_router.py for concurrency. The forward is currently single-threaded and token-by-token (~0.79 s/token on the reference machine); -T and -J do not apply. Prompts above INKLING_MAX_PROMPT (default 4096 tokens) are rejected with a clear 400.

Quality

Oracle: official IQ4_NL GGUF run by upstream llama.cpp (inkling2_loop) on "The capital of France is". Candidate logits come from tests/check_inkling; reproduce with python3 scripts/compare_inkling_logits.py quality/logits_oracle.bin quality/logits_q4.bin.

Variant Top-1 Logit KL(oracle) Top-10 overlap Correlation Max logit diff
Q4 experts 152717 ( Paris) 27.3686 0.0594 10/10 0.97889 5.37
Q8 experts 152717 ( Paris) 27.4252 0.0535 10/10 0.98145 5.08

Q4 vs Q8: KL 0.0083, correlation 0.99683, top-10 10/10. Greedy Q4 and Q8 continuations agree through Paris. and the following multiple-choice options; their tails differ, as does the IQ4_NL oracle continuation after Paris. (expected greedy divergence under different quantization). Most of the remaining oracle gap is implementation/format and the oracle's own 4-bit quantization, not Q4 expert storage.

Reproduce the export

The upstream safetensors are not redistributed here. With config.json and model-00001-of-00001.safetensors from the base model:

python3 scripts/export_inkling.py model-00001-of-00001.safetensors inkling_mini_q4.ink2
python3 scripts/export_inkling.py model-00001-of-00001.safetensors inkling_mini_q8.ink2 --experts q8

The exporter dequantizes NVFP4/MXFP8 experts to dense and re-quantizes them; Q8 matrices use per-64 scales. Container names omit the model.llm. prefix and the loader repacks into the engine's 4-row SDOT layout at load time.

Limitations

  • numallama's Inkling forward is a new text-only port. It matches the IQ4_NL oracle's top-1 and top-10 on the validation prompt, but long-form continuations will differ under greedy decoding.
  • No vision, audio, MTP, tool calling in the Inkling server, or continuous batching for this architecture.
  • Single-request server; -T / -J are not implemented for this path.
  • The engine and these derived weights are provided without warranty; verify behavior for your use case.

License and attribution

The base model and architecture are by Thinking Machines, licensed Apache-2.0. This repository contains derivative quantized weights and numallama-format tooling. See LICENSE (Apache-2.0 text), NOTICE, the upstream model card and the source revision above. The upstream IQ4_NL GGUF is a separate artifact and is not redistributed here.