Instructions to use RESMP-DEV/Inkling-2-Mini-MLA-LatentKV-Patched with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use RESMP-DEV/Inkling-2-Mini-MLA-LatentKV-Patched with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="RESMP-DEV/Inkling-2-Mini-MLA-LatentKV-Patched", trust_remote_code=True) messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForImageTextToText model = AutoModelForImageTextToText.from_pretrained("RESMP-DEV/Inkling-2-Mini-MLA-LatentKV-Patched", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use RESMP-DEV/Inkling-2-Mini-MLA-LatentKV-Patched with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "RESMP-DEV/Inkling-2-Mini-MLA-LatentKV-Patched" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "RESMP-DEV/Inkling-2-Mini-MLA-LatentKV-Patched", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/RESMP-DEV/Inkling-2-Mini-MLA-LatentKV-Patched
- SGLang
How to use RESMP-DEV/Inkling-2-Mini-MLA-LatentKV-Patched with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "RESMP-DEV/Inkling-2-Mini-MLA-LatentKV-Patched" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "RESMP-DEV/Inkling-2-Mini-MLA-LatentKV-Patched", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "RESMP-DEV/Inkling-2-Mini-MLA-LatentKV-Patched" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "RESMP-DEV/Inkling-2-Mini-MLA-LatentKV-Patched", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Docker Model Runner
How to use RESMP-DEV/Inkling-2-Mini-MLA-LatentKV-Patched with Docker Model Runner:
docker model run hf.co/RESMP-DEV/Inkling-2-Mini-MLA-LatentKV-Patched
Inkling 2 Mini - Latent KV (MLA-Style) Attention Patch (NOT YET TRAINED)
This checkpoint is not trained. It is a structural retrofit of the official
thinkingmachines/Inkling-2-Miniweights: the keys and values of two full-attention layers are factorized through a rank-512 latent and nothing else was updated. The new parameters are initialized from the base key and value projections by SVD, no continued-pretraining, SFT or RL step has been run, and the model is published only so the patch and its healing path can be inspected, reproduced and trained by others. Quality is worse than the base model, by the measured amount below. Do not use it as a production model.
Mechanism in one line: this is an MLA-style retrofit. Two full-attention layers keep softmax attention but factorize their key and value projections through a rank-512 latent; the cache stores the latent plus the short-convolution taps, and the expansion and convolution run after retrieval.
What changed
| Base model | thinkingmachines/Inkling-2-Mini, revision c9d028302cd0f035fdf8e7e91f089a4ce94d2195 |
| Architecture | inkling2_loop (24 physical layers, loop core 6..17, 3 loop passes) |
| Replaced layers | 11 and 17 only (both full-attention layers) |
| Untouched full-attention layers | 5 and 23, plus every sliding-window layer |
| New operator | latent_kv: keys and values factorized through a rank-512 latent, no RoPE |
| New parameters | 4,457,520 total (2,228,760 per patched layer) |
| Dropped parameters | none (0 tensors) |
| Precision | BF16 (the base checkpoint is NVFP4/MXFP8 quantized; this artifact is dequantized and trainable) |
KV cache: this artifact compresses the KV cache of the two patched layers.
Each patched full-attention slot stores the rank-512 latent and the 64
per-token dynamic short-convolution taps: 512 + 64 = 576 BF16 elements, or
1,152 bytes per token, instead of 2 x 8 x 128 = 2,048 elements (4,096 bytes).
The base short convolution is dynamic, so its taps are cached with the latent
and the expanded keys and values are reconstructed after retrieval. Measured at
16 tokens, every patched slot holds [1, 1, 16, 512] keys and [1, 1, 16, 64]
values.
At 1M tokens the six patched slots (layers 11 and 17, each visited three times by the loop) cost 17,664 bytes per token instead of 24,576, so the 1M BF16 cache drops from 30.674 GiB to 14.223 GiB (FP8 7.111 GiB, NVFP4 4.000 GiB). Those 1M numbers are exact extrapolations of the measured per-token layout, not a 1M-token forward.
The loop core runs layers 6..17 three times per forward, so the patched layers 11 and 17 are visited at positions 11/29/41 and 17/35/47.
The operator keeps the base q_proj, o_proj, the relative-position bias, the
learned attention sinks, the short convolutions and the gated output of the
replaced layers bit-for-bit. The base k_proj and v_proj are replaced by a
latent projection kv_a_proj (hidden size to rank 512) with a per-channel
kv_a_scale, followed by kv_b_k and kv_b_v (rank 512 back to the key and
value head dimensions). The latent factors are initialized by truncated SVD of
the concatenated base key and value projections, which is why this operator
starts close to the base model, unlike the zero-gated recurrence sibling.
Measured damage (this artifact, untrained)
Cross-entropy in nats, 512-token samples, computed with the model's own label shifting on the BF16 artifact:
| variant | fixed sample (CE_SAMPLE.md) |
plain English prose |
|---|---|---|
base thinkingmachines/Inkling-2-Mini |
1.680312 | 2.566605 |
this artifact (latent_kv, SVD rank 512) |
1.734075 | 2.569875 |
| damage | +0.053763 | +0.003270 |
The SVD reconstruction error of the replaced projections is 0.4785 / 0.4765 relative for keys and 0.5429 / 0.5195 for values on layers 11 and 17. That is the initialization error of the latent factorization in weight space, before any training.
Preservation proof
The converter compared the artifact against an independently loaded copy of the base checkpoint, tensor by tensor:
- 1115 preserved tensors compared, 0 mismatches, maximum absolute difference 0.0 (bit-identical, not merely close)
- 10 tensors added (
kv_a_proj.weight,kv_a_scale,kv_b_k.weight,kv_b_v.weightandout_scalefor layers 11 and 17), 4,457,520 parameters - 0 tensors dropped: every base tensor of the replaced layers still exists
- the saved artifact was reloaded through the Hub remote-code path
(
AutoModelForImageTextToText,trust_remote_code=True) and produced logits identical to the in-memory model (maximum absolute difference 0.0)
The full record is in patch_manifest.json next to the weights.
How to load
import torch
from transformers import AutoModelForImageTextToText, AutoTokenizer
model = AutoModelForImageTextToText.from_pretrained(
"RESMP-DEV/Inkling-2-Mini-MLA-LatentKV-Patched",
torch_dtype=torch.bfloat16,
trust_remote_code=True,
)
tokenizer = AutoTokenizer.from_pretrained(
"RESMP-DEV/Inkling-2-Mini-MLA-LatentKV-Patched"
)
The artifact ships one self-contained remote-code module,
modeling_inkling2_loop_patched.py, which also defines the patched
configuration classes, and carries patch_config inside config.json:
{
"operator": "latent_kv",
"patched_layer_ids": [11, 17],
"state_mode": "reset",
"delta_chunk_size": 64,
"delta_decay_init": -0.1053605,
"delta_beta_init": 0.0,
"out_gate_init": "zero",
"latent_rank": 512,
"kernel_backend": "recurrent",
"init_seed": 20261124
}
transformers 5.24.1 or newer is required: the inkling2_loop architecture
does not exist in earlier releases.
One field of the config above is worth reading precisely: out_gate_init is
zero, but that value only applies to the gated delta-rule operator. The
latent-KV operator always initializes its per-head output gate to one, and the
shipped weights confirm it: out_scale is exactly 1.0 for every head of both
patched layers. This artifact is therefore switched on at initialization,
which is why it starts close to the base model, while the gated-delta sibling
starts switched off.
What the cache costs, and what concurrency it buys
A patched full-attention slot stores a 512-dimensional latent key and value plus 64 per-token dynamic short-convolution taps, so it costs 1152 bytes per token in BF16 instead of the base model's 4096. At 1M tokens the model keeps 14.223 GiB of BF16 KV cache per session against 30.674 GiB for the base model, or 7.111 GiB in FP8 and 4.000 GiB in NVFP4. In a 40 GiB KV budget that is about 2.8 concurrent sessions at a 1M context, against 1.3 for the base model. Those are exact extrapolations of the measured per-token cache layout, not a 1M-token forward.
The gated-delta sibling keeps zero bytes per token for its patched layers and reaches about 256 sessions at the same context and budget. The choice between the two artifacts is the choice between a small, already-on repair that costs a little cache and a maximum-compression retrofit that starts switched off and has to be healed.
Healing path (not run)
The repository that produced this checkpoint ships a three-stage harness with
CPT, SFT and GRPO stages, telemetry, receipts and checkpoint resume. The 26B
model does not fit on two 24 GiB cards with full-parameter AdamW (53 GB of BF16
weights, roughly 370 GB of optimizer state), so the shipped configs use a
parameter-efficient mode: LoRA adapters on the patched attention projections
plus the new patch parameters, which are always trainable. See
training/inkling_patch/RUNBOOK.md for the exact commands. Because
this operator's output gate starts at one, its heal is a rank bottleneck rather
than a switch that has to be opened, and it needs no gate floor. The same
warning still applies to the healing run: cross-entropy on the training text
alone is a misleading objective, because a short adapter run can drive the
training loss down while making the model worse on text it has not seen. The
producing repository's sweep measures both, and the gated-delta card reports
the numbers.
Non-claims
- No training step of any kind was run on this checkpoint. The parameters that differ from the base model are initialized, not learned.
- The measured cross-entropy numbers are damage measurements on two short samples, not an evaluation of model quality, and they say nothing about behaviour after healing.
- The runtime cost of the latent KV projection was not measured on any accelerator; no throughput or memory number is claimed here.
- The cache layout was measured after a 16-token forward. The 1M numbers are exact extrapolations of that per-token layout, not a 1M-token forward, and the NVFP4 row assumes E2M1 values with one E4M3 scale per 16 values.
- The SVD initialization is a least-squares approximation of the base key and value maps, not a proof that the latent bottleneck preserves model behaviour.
- The vision tower, the routed experts, the loop message gates, the MTP head configuration and every other part of the base checkpoint are untouched and were verified bit-identical.
- Downloads last month
- -
Model tree for RESMP-DEV/Inkling-2-Mini-MLA-LatentKV-Patched
Base model
thinkingmachines/Inkling-2-Mini