Skip to content
Computer vision

Inkling-2-Mini-MLA-LatentKV-Looping-4Layer-HealProbe

3.5x KV cache compression

2 min readupdated

An experimental research patch based on the multimodal model (VLM) thinkingmachines/Inkling-2-Mini (26.4B parameters, inkling2_loop architecture) by RESMP-DEV. The author replaced key and value projections across all four full-attention layers with a rank-512 latent representation using the MLA (Multi-Head Latent Attention memory-compression method) principle to radically reduce context memory consumption. To compensate for the loss of accuracy after the weight restructuring, the model underwent a 32-step "heal probe" fine-tuning with LoRA (small trainable adapters) using just 16,384 tokens. Important: this is not a production-ready model after full training, but a research artifact demonstrating a method for rapid weight recovery following architectural surgery.

Key features

  • KV cache savings: the cache volume per token is reduced from 32,768 to 9,216 bytes in BF16, which decreases the required memory from 30.674 GiB to 8.739 GiB on a 1M token context.
  • Cyclic architecture handling: in inkling2_loop, layers 6–17 run three times per pass, so patching the looped layers 11 and 17 provides a triple memory gain.
  • 32-step recovery: initialization via SVD (singular value decomposition) and a short rank-64 LoRA probe restored 98.0% of the lost accuracy on a validation slice.
  • Dequantized BF16 weights: unlike the base checkpoint in NVFP4/MXFP8 formats, this version has been converted to BF16 and is ready for further fine-tuning.

What you can do

  • Explore model recovery recipes: use the code and configs from the repository (heal/config.json, modeling_inkling2_loop_patched.py) as a base for experimenting with KV cache compression in cyclic architectures.
  • Run full fine-tuning: take the ready BF16 checkpoint with merged LoRA weights for full SFT (supervised fine-tuning) or RL, as the author only limited themselves to a 32-step check.
  • Compare the memory-quality trade-off: contrast this 4-layer version with the 3-layer variant ([5, 11, 17]), which sacrifices part of the memory savings for lower cross-entropy.

Example

import torch
from transformers import AutoModelForImageTextToText, AutoTokenizer

model_id = "RESMP-DEV/Inkling-2-Mini-MLA-LatentKV-Looping-4Layer-HealProbe"
model = AutoModelForImageTextToText.from_pretrained(
    model_id, torch_dtype=torch.bfloat16, trust_remote_code=True
)
tokenizer = AutoTokenizer.from_pretrained(model_id)
Read moreDetails
Cross-entropy on a held-out agent slice (4096 tokens): 1.5088 for the base, 1.9731 before healing, and 1.5183 after the heal probe (+0.0095 from base).
Calculated concurrency with a 40 GiB KV cache budget on a 1M context: up to 4.58 sessions versus 1.30 for the base (upper estimate excluding weights and activations).
Requirements: transformers library version 5.24.1 or newer and the trust_remote_code=True flag; inference speed measurements on accelerators were not conducted.
License: Apache 2.0.
Discuss Telegram 0 20

Will it run?

Runs in 4-bit

Full precision does not fit, a quantised version does: quality barely changes down to 8 bits, more noticeably at 4 bits.

  • BF16weights 49 GB · ready files55 GB
  • FP8 / INT8recommendedweights 25 GB28 GB
  • 4-bitweights 14 GB16 GB

Tip: go 8-bit.FP8 / INT8 is within about a percent of full precision in quality, takes half the memory and runs faster on RTX 40/50 and H100. Full precision only pays off for fine-tuning.

Estimate: weights plus working memory. Long videos, high resolutions and long contexts need more.

Run it on Massed Compute

The script downloads the model to the rented machine. How to run it is in the model card.

  1. 1. Rent a machine with a fitting GPU

    Open Massed Compute
  2. 2. Paste the script into the machine's terminal

    Connect over SSH (the Massed Compute panel shows the command) or open a terminal on the machine's desktop.

    HF_TOKEN / CIVITAI_TOKENThe script starts with token lines: paste yours between the quotes. The Hugging Face token is for gated models, the Civitai one for Civitai models.

    # RESMP-DEV/Inkling-2-Mini-MLA-LatentKV-Looping-4Layer-HealProbe
    mkdir -p ~/models
    curl -LsSf https://astral.sh/uv/install.sh | sh
    source "$HOME/.local/bin/env"
    uv tool install "huggingface_hub[cli]"
    hf download RESMP-DEV/Inkling-2-Mini-MLA-LatentKV-Looping-4Layer-HealProbe --local-dir ~/models/Inkling-2-Mini-MLA-LatentKV-Looping-4Layer-HealProbe
    # The model is in ~/models. How to run it is in the model card (link above).
  3. 3. Use it

    The model is in ~/models. How to run it is in the model card (link above).

Stop the machine in the panel when you are done: it bills by the minute while it runs.

How to speed it up

Picked for this model type. Choose your hardware above to see what fits you exactly.

  • FlashAttention 44.0.0b41from November 25, 2026new release

    fastest exact attention on B200

    Kernels for Blackwell (beta). Exact attention without quantisation — fine for everything, LLMs included.

    How to enable: pip install flash-attn-4; vLLM and SGLang pick it up themselves.

    Earlier generations (2)
    • FlashAttention 3 — The Hopper (H100/H200) version with FP8.
    • FlashAttention 2 — The standard for RTX 30/40/50 and A100: exact attention without the memory cost of long contexts.
  • torch.compile2.15.0from October 28, 2026

    10–30% for free

    Compiles the model for your GPU. Slower first run, faster afterwards.

    How to enable: model = torch.compile(model); in ComfyUI the TorchCompileModel node.

Model family

New posts about versions of Inkling-2-Mini (quants, finetunes, LoRAs) will show up under the bell.

Quantised versions 12All on Hugging Face
Fine-tunes 12All on Hugging Face
LoRAs and adapters 2All on Hugging Face

About the model

RESMP-DEV/Inkling-2-Mini-MLA-LatentKV-Looping-4Layer-HealProbe
Author
RESMP-DEV
Category
Computer vision
Released
Posted

On NeyroLearn

Hugging Face

200

Ask AI about this model

Answered by Gemini 4 · the chat is kept only in this tab

Comments