Instructions to use RESMP-DEV/Inkling-2-Mini-MLA-LatentKV-Looping-4Layer-HealProbe 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-Looping-4Layer-HealProbe 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-Looping-4Layer-HealProbe", 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-Looping-4Layer-HealProbe", 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-Looping-4Layer-HealProbe 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-Looping-4Layer-HealProbe" # 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-Looping-4Layer-HealProbe", "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-Looping-4Layer-HealProbe
- SGLang
How to use RESMP-DEV/Inkling-2-Mini-MLA-LatentKV-Looping-4Layer-HealProbe 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-Looping-4Layer-HealProbe" \ --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-Looping-4Layer-HealProbe", "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-Looping-4Layer-HealProbe" \ --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-Looping-4Layer-HealProbe", "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-Looping-4Layer-HealProbe with Docker Model Runner:
docker model run hf.co/RESMP-DEV/Inkling-2-Mini-MLA-LatentKV-Looping-4Layer-HealProbe
Inkling 2 Mini - MLA Latent-KV Looping Patch, 4 Layers (HEAL PROBE, NOT TRAINED)
This checkpoint is not trained and is not ready for use as is. It is a structural retrofit of the official
thinkingmachines/Inkling-2-Miniweights (the keys and values of all four full-attention layers are factorized through a rank-512 latent) plus a 16,384-token healing probe: 32 optimizer steps on an owned agentic corpus, nothing more. No full continued-pretraining, SFT or RL stage has been run. The heal probe recovers 98.0 percent of the patch's initialization damage on a small held-out slice, so the model is close to the base checkpoint on that slice, but that slice is a damage measurement and not a benchmark. Treat this as a research artifact that shows a measured repair path, not as a production model.
Mechanism in one line: this is an MLA-style retrofit combined with the model's own layer looping. The four full-attention layers (5, 11, 17, 23) keep softmax attention but factorize their key and value projections through a rank-512 latent; the KV cache stores the latent plus the 64 short-convolution taps, and the expansion and convolution run after retrieval. Because the loop core runs layers 6..17 three times per forward, the patched layers 11 and 17 occupy three cache slots each, so patching them is what makes the cache term shrink.
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 | 5, 11, 17 and 23, that is every full-attention layer |
| Untouched layers | every sliding-window layer, the vision tower, the routed experts, the MTP head |
| New operator | latent_kv: keys and values factorized through a rank-512 latent, no RoPE |
| New parameters | 8,915,040 total (2,228,760 per patched layer) |
| Dropped parameters | none (0 tensors) |
| Added by the heal probe | 26,738,688 LoRA parameters, rank 64, alpha 64, on the attention projections |
| Precision | BF16 (the base checkpoint is NVFP4/MXFP8 quantized; this artifact is dequantized and trainable) |
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.
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. Layers 11 and 17 are visited three times each by the loop, so patching all four full-attention layers takes the growing cache term from 32,768 to 9,216 bytes per token: at a 1M context that is 8.739 GiB of BF16 KV cache per session against 30.674 GiB for the base model, or about 4.58 concurrent sessions in a 40 GiB KV budget against 1.30 for the base model. The 20 sliding-window layers contribute a bounded 0.156 GiB per session at that context, 0.4 percent of the budget.
Those 1M numbers are exact extrapolations of the measured per-token cache layout (measured after a 16-token forward), not a 1M-token forward. The concurrency column is a KV-budget calculation that excludes weights, routed experts, activations and runtime overhead, so it is an upper bound on sessions, not a measured serving capacity.
Measured damage and measured repair
Cross-entropy in nats on the owned agentic holdout (eight disjoint 512-token windows, 4096 tokens from six records), computed with the model's own label shifting on the BF16 artifact:
| variant | owned-holdout CE | against base |
|---|---|---|
base thinkingmachines/Inkling-2-Mini |
1.5088 | 0 |
| this artifact, untrained | 1.9731 | +0.4643 |
| this artifact, after the 16,384-token heal probe | 1.5183 | +0.0095 |
The heal probe recovers 98.0 percent of the initialization damage. Paired against the three-layer sibling below, this artifact is 0.0398 nats worse with a standard error of 0.0095, and all eight windows prefer the three-layer.
Confirmed on a larger slice. The eight-window slice could not separate this artifact from the base checkpoint: it sat 0.0095 above base at p = 0.673. Scoring 64 windows of 512 tokens on the same corpus, the same tokenizer and the same label shifting gives this artifact 1.1495, the three-layer 1.1224 and the base checkpoint 1.1644. Paired, this artifact is 0.0272 nats worse than the three-layer (t(63) = -9.493, 58 of 64 windows, effect size 1.19) and 0.0149 nats better than the base checkpoint (p = 0.0487, which is at the detection limit of that slice). So on the larger slice this artifact is at or slightly better than the base checkpoint, not 0.0095 above it.
The heal recipe, exactly. 32 optimizer steps of 512 tokens each (16,384 tokens), seed 20261130, AdamW with two parameter groups (patch parameters at 1.444e-4, LoRA adapters at 5.174e-4), cosine decay from the first step, no warmup, gradient clipping at 1.0, on the shipped harness's packed corpus stream over 1270 owned agentic records with EOS separation and shuffling. The patch parameters and the LoRA adapters are both trainable; 35,653,728 parameters were trainable in total.
Why the data stream matters more than the operator. On a fixed-window training stream (64 records, one repeated window per step) this artifact's ladder improves at every rung but never past 1.6283 at 32,768 tokens. The same budget on the full-corpus packer reaches 1.5183. An earlier reading that this patch does not repair came from a harness that reused one 512-token window for every step; on that harness the model memorized the window and lost 0.806 nats on text it had not seen.
Patch parameters are not the healing mechanism. A six-style sweep at 4096 tokens (adapter only, patch only, joint, joint at rank 64, two-stage, and a full-attention control) separates the operator from the adapter: the best style was the joint rank-64 recipe, and freezing the patch at its initialization was only 0.0346 nats behind it. The patch sits in the forward path and receives gradient, but the adapter configuration, not the patch parameters, is what recovers the loss.
The three-layer sibling, and the trade this artifact makes
A three-layer variant of the same retrofit patches only layers 5, 11 and 17 and
leaves layer 23 alone. It is published alongside this one as
RESMP-DEV/Inkling-2-Mini-MLA-LatentKV-Looping-4Layer-HealProbe.
| artifact | untrained CE | healed CE | 1M BF16 cache | sessions at 40 GiB |
|---|---|---|---|---|
| base | 1.5088 | - | 30.674 GiB | 1.30 |
three-layer [5,11,17] |
1.5458 | 1.4786 | 11.481 GiB | 3.48 |
four-layer [5,11,17,23] (this repo) |
1.9731 | 1.5183 | 8.739 GiB | 4.58 |
Layer 23 is the expensive slot. It costs 0.4306 nats of damage and saves the same 2.9 GiB at 1M that layer 5 saves, because it is counted once by the loop while 11 and 17 are counted three times. The heal probe gives most of that damage back; the residue is 0.0398 nats for 1.10 extra concurrent sessions, a 32 percent concurrency gain. A larger latent rank does not help: rank 768 on all four layers measures 1.9185 untrained, still far from the base model, for 44 percent more cache. A hybrid that keeps delta on the two tripled slots and latent-KV on the two single slots lands at 2304 bytes per token and 17.38 sessions, but its cross-entropy is 2.0924, worse than pure delta on all four layers at 2.0460, so there is no useful middle point between cheap MLA on the looped slots and maximum compression.
How to load
import torch
from transformers import AutoModelForImageTextToText, AutoTokenizer
model = AutoModelForImageTextToText.from_pretrained(
"RESMP-DEV/Inkling-2-Mini-MLA-LatentKV-Looping-4Layer-HealProbe",
torch_dtype=torch.bfloat16,
trust_remote_code=True,
)
tokenizer = AutoTokenizer.from_pretrained(
"RESMP-DEV/Inkling-2-Mini-MLA-LatentKV-Looping-4Layer-HealProbe"
)
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": [5, 11, 17, 23],
"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
}
out_gate_init is zero in that block, but that value only applies to the
gated delta-rule operator. The latent-KV operator initializes its per-head
output gate to one, and the shipped weights confirm it: out_scale is exactly
1.0 for every head of every patched layer. This artifact is switched on at
initialization, which is why it starts close to the base model, while the
gated-delta sibling starts switched off.
transformers 5.24.1 or newer is required: the inkling2_loop architecture
does not exist in earlier releases.
What ships beside the weights
| file | what it is |
|---|---|
merge_receipt.json |
the exact merge that produced this directory: source paths, config digest, checkpoint step, merged module count, per-file SHA-256 |
heal/config.json |
the heal config that produced the checkpoint, including the two learning-rate groups and the seed |
heal/step_000032/adapters.pt |
the trained state: the LoRA adapters and the trained patch parameters |
heal/step_000032/metadata.json |
checkpoint metadata, digests and run statistics |
heal/receipt.json |
the training receipt for the 32-step probe |
heal/EVAL.json |
the held-out window scores behind the 1.5183 number |
heal/holdout-64window-ce.json |
the 64-window scores for this artifact, the three-layer and the base checkpoint |
heal/holdout-64window-statistics.json |
the paired statistics over those 64 windows |
LICENSE |
Apache 2.0 |
The weights in this repository are the merged form of heal/step_000032: the
LoRA deltas are folded into the attention projections and the trained patch
parameters are written into the patched layers. The merge is a numerical rewrite
of the same checkpoint, not a training step.
Non-claims
- This model is not trained. The heal probe is 16,384 tokens on one artifact; no full continued-pretraining, SFT or RL stage has run.
- Eight 512-token windows on an owned agentic holdout are a damage measurement, not a benchmark, and the holdout selected the trial that produced this configuration.
- The eight windows span 4096 tokens from six records. The standard error of the mean on that slice is about 0.08, so the 0.0095 gap to the base checkpoint is a point estimate inside the slice's noise; the 64-window confirmation above puts this artifact 0.0149 nats below base at p = 0.0487, which is at the detection limit.
- The corpus split is session-key disjoint but not prompt-disjoint: 16 of 161 holdout records share a boilerplate suffix and 11 share a 256-character task-prompt prefix with train.
- The heal ran on Apple MPS, whose
index_putandscatter_reduceare nondeterministic, so 1.5183 is one run and not a bit-exact guarantee. - The cache figures are exact extrapolations of a measured 16-token layout, not a 1M-token forward, and the session counts exclude weights, experts, activations and runtime overhead.
- No throughput measurement was taken on any accelerator for this operator.
- 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 at conversion time.
- Downloads last month
- 38
Model tree for RESMP-DEV/Inkling-2-Mini-MLA-LatentKV-Looping-4Layer-HealProbe
Base model
thinkingmachines/Inkling-2-Mini