Instructions to use RESMP-DEV/Inkling-2-Mini-LinearAttention-GatedDelta-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-LinearAttention-GatedDelta-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-LinearAttention-GatedDelta-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-LinearAttention-GatedDelta-Patched", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use RESMP-DEV/Inkling-2-Mini-LinearAttention-GatedDelta-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-LinearAttention-GatedDelta-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-LinearAttention-GatedDelta-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-LinearAttention-GatedDelta-Patched
- SGLang
How to use RESMP-DEV/Inkling-2-Mini-LinearAttention-GatedDelta-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-LinearAttention-GatedDelta-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-LinearAttention-GatedDelta-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-LinearAttention-GatedDelta-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-LinearAttention-GatedDelta-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-LinearAttention-GatedDelta-Patched with Docker Model Runner:
docker model run hf.co/RESMP-DEV/Inkling-2-Mini-LinearAttention-GatedDelta-Patched
Inkling 2 Mini - Gated Delta Attention Patch (NOT YET TRAINED)
This checkpoint is not trained. It is a structural retrofit of the official
thinkingmachines/Inkling-2-Miniweights: all four of the model's full-attention layers were replaced by a non-linear gated delta-rule recurrence and nothing else was updated. The new parameters are at their initialization values, 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 a linear-attention retrofit. Every full-attention layer is replaced by a gated delta-rule recurrence, so its cost grows linearly with sequence length and those layers keep no KV cache at all.
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 in the model |
| Untouched layers | every sliding-window layer, plus the vision tower, the routed experts, the loop message gates and the MTP head |
| KV cache from the patched layers | 0 bytes per token (a constant-size recurrent state instead) |
| New operator | gated_delta: a gated delta-rule recurrence with a constant-size state |
| New parameters | 454,944 total (113,736 per patched layer) |
| Precision | BF16 (the base checkpoint is NVFP4/MXFP8 quantized; this artifact is dequantized and trainable) |
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, while the patched
layers 5 and 23 are visited once each. The recurrence state is reset at the
start of every visit (state_mode: reset); carry keeps it across the loop
passes of one forward.
The operator keeps the base q_proj, k_proj, v_proj and o_proj of the
replaced layers bit-for-bit and reuses the base short convolutions and norms.
It does not use the relative-position bias, the learned attention sinks or
the log-scaled query normalization of those layers; that functional loss is
exactly what the healing phase has to recover.
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 | model-card text | plain English prose | technical runbook text |
|---|---|---|---|
base thinkingmachines/Inkling-2-Mini |
1.5442 | 2.5663 | 2.0159 |
this artifact (gated_delta, zero-gated output) |
1.8332 | 2.8222 | 2.5312 |
sibling artifact (latent_kv, SVD rank 512, layers 11 and 17) |
1.6001 | 2.5737 | 2.0734 |
All four numbers are cross-entropy in nats over 512-token windows, computed with the model's own label shifting on the dequantized BF16 checkpoints. The three texts are the artifact's own model card, a fixed English paragraph and this repository's runbook, so the base model is the reference for each column.
The gated_delta output gate is initialized to zero, so the untrained patch is
an attention ablation rather than noise: the patched layers contribute nothing
until the gate is trained open. The latent_kv sibling is a different artifact
with an MLA-style low-rank latent KV that is initialized from the base key and
value projections by SVD, which is why it starts much closer to the base model.
Preservation proof
The converter compared the artifact against an independently loaded copy of the base checkpoint, tensor by tensor:
- 1099 preserved tensors compared, 0 mismatches, maximum absolute difference 0.0 (bit-identical, not merely close)
- 24 tensors added (the new gated-delta parameters of layers 5, 11, 17 and 23)
- 16 tensors dropped (
relative_position_bias.*andsink_proj.weightof the four patched layers), which the recurrence does not consume - 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 reload check measures its own tolerance instead of trusting a constant. The converter perturbs every BF16 weight of the reloaded model by one unit in the last place, re-runs the forward, and uses the resulting logit change as the tolerance: 3.3228 for this artifact. That is not a formality. The same converter on a different machine produced a reload difference of 2.5917 on the same operator, because the routed-expert matmul reduces in a different order there, while the patch itself moves the logits by 9.640. A fixed absolute tolerance cannot separate 2.59 from 9.64 on this model; a measured one can.
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-LinearAttention-GatedDelta-Patched",
torch_dtype=torch.bfloat16,
trust_remote_code=True,
)
tokenizer = AutoTokenizer.from_pretrained(
"RESMP-DEV/Inkling-2-Mini-LinearAttention-GatedDelta-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": "gated_delta",
"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
}
transformers 5.24.1 or newer is required: the inkling2_loop architecture
does not exist in earlier releases.
What the cache costs, and what concurrency it buys
The patched layers keep a constant-size recurrent state instead of a per-token key and value cache. At 1M tokens the model therefore keeps only the sliding-window layers of the loop, which is 0.156 GiB of BF16 KV cache per session, against 30.674 GiB for the base model. In a 40 GiB KV budget that is about 256 concurrent sessions at a 1M context, against 1.3 for the base model. Those are exact extrapolations of the measured per-token cache layout at a 16-token forward, not a 1M-token forward.
For comparison, the sibling low-rank MLA artifact caches 1152 bytes per token for its two patched layers, so at 1M it keeps 14.223 GiB per session and fits 2.8 sessions in the same 40 GiB budget. The delta retrofit keeps zero.
Healing path, and one measured warning about it
The repository that produced this checkpoint ships a three-stage harness,
training/inkling_patch/heal.py, 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.
Two measurements from a short real heal run on this artifact are worth reading before starting that work, because they change what the objective should be.
The output gate starts at zero, so cross-entropy alone does not reward opening it. A gated delta layer multiplies its own attention output by a per-head gate that is initialized to zero. Until the gate moves, the patched layer contributes nothing and no gradient reaches its own projections, because the gate multiplies them by zero. In a 16-trial multi-objective sweep over the adapter learning rate, the patch learning rate, the LoRA rank and alpha, the corner that minimizes training cross-entropy moved the patch parameters by 1.23e-4 and the corner that opens the gate moved them by 3.42e-2, 278 times further, for 0.024 nats. A sweep ranked on the training loss therefore returns a configuration in which the patched attention is never switched on and the adapters merely compensate for four dead attention layers.
The training loss and the held-out loss can disagree in sign. In a 12-trial sweep with a held-out text that is genuinely disjoint from the training text, the configuration with the lowest training cross-entropy, 0.4332 after eight steps, was 0.806 nats worse on the held-out text than this artifact is before any training at all. The configuration that opened the gate instead, at a higher training loss of 1.2692, was 0.198 nats better than the untrained artifact, and the artifact starts 0.5153 nats above the base model on that text. Eight steps recovered 38 percent of the damage and the gate had reached 0.0295 of the 0.1 floor the run asked for.
The practical consequence for the healing run: train the patch parameters with their own learning rate, and put a floor on the output gate inside the loss, so that "the patch is on" is part of the objective instead of a side effect. The harness in the producing repository implements exactly that as a gate-floor term.
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 heal numbers above come from short runs on a separate copy of the same artifact and are not weights that ship in this repository.
- 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 patched layers was not measured on any accelerator. The recurrence is linear in sequence length by construction, but no throughput or memory number is claimed here.
- The relative-position bias, the learned sinks and the log-scaled query normalization of the patched layers are gone; a healed model would have to re-acquire that behaviour or accept its loss.
- 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-LinearAttention-GatedDelta-Patched
Base model
thinkingmachines/Inkling-2-Mini