KVBridge Ministral 3 3B → 8B Mapper
This repository releases a fitted cross-model KV-cache mapper from
mistralai/Ministral-3-3B-Reasoning-2512
to
mistralai/Ministral-3-8B-Reasoning-2512.
It is an independent reproduction of the method in NVIDIA's paper
Cross-Model KV Cache Transfer in LLM Families: A Closed-Form Linear Mapping for Prefill Reuse,
implemented against the authors' KVBridge repository.
This is a general-purpose replication artifact and is not affiliated with or endorsed by NVIDIA or Mistral AI.
What this artifact does
KVBridge allows a smaller model to prefill a context and maps its KV cache into the cache space expected by a larger model in the same family. The larger model can then continue from that mapped cache without recomputing the complete context itself.
This repository is not a standalone language model. It contains the linear mapper used between the two exact model revisions below; users must separately obtain both base models under their respective licenses.
| Role | Model | Pinned revision |
|---|---|---|
| Source/prefill | mistralai/Ministral-3-3B-Reasoning-2512 |
4a36357c811bf511a7b625d132e12f22408aac91 |
| Target/decode | mistralai/Ministral-3-8B-Reasoning-2512 |
81eaece1948f3875421d9a45bc55487d10e2d894 |
Do not assume compatibility with other checkpoints, revisions, KV geometries, or quantized model variants without refitting and validation.
Files
| File | Purpose |
|---|---|
mapper.safetensors |
Fitted per-target-layer key/value affine maps (float32, 7.42 GB) |
mapper.json |
Model pair, RoPE, layer selection, fit, and format metadata |
kvbridge_ministral3_v1.patch |
General Ministral-3 text-decoder and exact-YaRN compatibility patch for KVBridge |
example.py |
Minimal cache-transfer example |
artifact_manifest.json |
Machine-readable provenance and evaluation summary |
checksums.sha256 |
SHA-256 integrity checks |
The weights are preserved in float32 exactly as fitted. For runtime use, load them as BF16 to reduce resident mapper memory:
import torch
from kvbridge import Mapper
mapper = Mapper.from_pretrained(
"alphamike/kvbridge-ministral3-3b-to-8b",
device="cuda:0",
dtype=torch.bfloat16,
)
Install the compatible KVBridge revision
The upstream KVBridge code did not directly load the text decoder inside the multimodal Ministral-3 repositories at the pinned revision used here. Apply the included general compatibility patch:
git clone https://github.com/spotta85/kvbridge.git
cd kvbridge
git checkout fdc11d31f005d7d4cec949b72e9032f2093dd6b8
wget https://huggingface.co/alphamike/kvbridge-ministral3-3b-to-8b/resolve/main/kvbridge_ministral3_v1.patch
git apply kvbridge_ministral3_v1.patch
pip install -e .
The patch adds text-only loading for Ministral-3 checkpoints and preserves their
exact YaRN rotary-position specification during cache transfer. See
example.py for a small end-to-end cache handoff. The current transfer runtime
supports batch size 1.
Mapper fit
The mapper follows the paper's content-space, closed-form ridge procedure:
- 500 calibration texts × 1,024 tokens;
- stride 4, giving 128,000 token observations;
- all 26 source layers used for each of 34 target layers (
top_k=26); - ridge coefficient
0.01; - 8 KV heads with head dimension 128;
- fitted key/value parameters: 1.85B;
- fitting time: 200.4 seconds;
- peak fitting GPU memory: 16.08 GiB;
- mean fit R²: 0.8789 for keys and 0.7611 for values.
The R² values are fit diagnostics, not downstream task accuracy. The calibration
corpus content hash is
985f7bc5a29212748fc05de6f4cdebe9a024f47e2d6c5c7eae084d80cd690ead.
Reproduction accuracy
These are frozen, full-task results from this independent Ministral 3B→8B replication. “Retention” is mapped accuracy divided by native target accuracy. The paper values are included only as a reference; the model pair and execution environment are not identical to every experiment in the paper.
| Task | Native 8B | Mapped 3B→8B | Raw retention | Floor-normalized retention |
|---|---|---|---|---|
| ARC-Challenge | 60.15% | 57.34% | 95.32% | 91.99% |
| HellaSwag | 76.86% | 74.13% | 96.45% | 94.74% |
| WinoGrande | 71.43% | 67.01% | 93.81% | 79.37% |
| MMLU, 5-shot | 70.15% | 58.96% | 84.05% | 75.22% |
| GSM8K, 8-shot CoT, strict match | 82.94% | 19.94% | 24.04% | 24.04% |
| Mean | — | — | 78.73% | 73.07% |
GSM8K flexible answer extraction gives 73.01% mapped accuracy, but the strict exact-match score above is the primary reported result. The large gap between the two makes GSM8K particularly sensitive to answer formatting and evaluation protocol.
For context, the paper's five-task reference values for its reported native and mapped setup were 76.2% mean raw retention and 65.9% mean floor-normalized retention. This artifact's result should be read as a reproduction on the pinned Ministral pair, not as an exact hardware- or model-matched rerun of every paper result.
Prefill and mapping latency
Measured on one NVIDIA A100 40 GB GPU in BF16, batch size 1, with 2 warmups and 7 timed trials. “Warm map” is mapper execution after the source KV cache already exists, matching the paper's cache-transfer timing boundary. “Cold source+map” includes the 3B source prefill and is the relevant end-to-end replacement for native 8B prefill.
| Context tokens | Native 8B prefill | Source 3B prefill | Warm map | Cold source+map | Warm speedup | Cold speedup |
|---|---|---|---|---|---|---|
| 64 | 28.8 ms | 22.0 ms | 24.4 ms | 46.4 ms | 1.18× | 0.62× |
| 512 | 51.5 ms | 26.1 ms | 35.5 ms | 61.6 ms | 1.45× | 0.84× |
| 1,024 | 91.7 ms | 42.1 ms | 50.2 ms | 92.4 ms | 1.83× | 0.99× |
| 2,048 | 170.6 ms | 82.6 ms | 80.0 ms | 162.6 ms | 2.13× | 1.05× |
| 4,096 | 336.9 ms | 167.1 ms | 141.8 ms | 308.9 ms | 2.38× | 1.09× |
| 8,192 | 706.4 ms | 361.5 ms | 275.5 ms | 637.0 ms | 2.56× | 1.11× |
| 16,384 | 1,564.5 ms | 837.9 ms | 542.2 ms | 1,380.1 ms | 2.89× | 1.13× |
Absolute latency depends strongly on hardware, kernels, dtype, software stack, and whether source prefill is included. A simultaneous 3B+8B 32K run did not fit on the single 40 GB A100 used here. The paper's 32K timing used 8×H100 NVLink and excluded source prefill, so those absolute numbers are not directly comparable.
Limitations
- Accuracy is not guaranteed to match native 8B prefill; degradation is highly task dependent, and strict GSM8K is a clear failure case.
- This artifact is tied to the exact source/target revisions listed above.
- Transfer currently supports batch size 1.
- The 7.42 GB float32 mapper is large; BF16 runtime loading is recommended.
- The base models must be downloaded separately and may require substantial GPU memory. Follow their licenses and acceptable-use terms.
- This artifact is for research and engineering evaluation. Validate it for the intended application before deployment.
Integrity
2de7fbd8d88ebe12433b73878ce5f847b2b3fa32b177b98f2acd26e0ba2489c3 mapper.json
dd37580166c40dc86afaccf6e80829b44af29a033e1e3675c85a1d28eff64093 mapper.safetensors
fd0f7e734fabdcfee4585b338a9168d62159fba39015aae077aa1ed7c5b253e0 kvbridge_ministral3_v1.patch
Citation
If this artifact is useful, cite the original method:
@article{heo2026crossmodel,
title={Cross-Model KV Cache Transfer in LLM Families: A Closed-Form Linear Mapping for Prefill Reuse},
author={Heo, Taekyung and Shafipour, Rasoul and Zhao, Ritchie and Golub, Maximilian and Kamani, Mohammad Mahdi and Borkar, Ritika and Chandran, Makesh Tarun and Zardoshti, Pantea and Darvish Rouhani, Bita},
journal={arXiv preprint arXiv:2608.03893},
year={2026}
}
Licenses and acknowledgements
The mapper artifact and compatibility patch are released under MIT. The pinned Mistral base-model repositories are licensed separately under Apache-2.0. This release builds on the method and open-source implementation from the NVIDIA paper authors; please credit their work and review the upstream repositories.
Model tree for alphamike/kvbridge-ministral3-3b-to-8b
Base model
mistralai/Ministral-3-3B-Base-2512