kamahara/Qwen3-VL-PK-MiniMax-H3
projection keys for MiniMax H3
2 min readupdated
The matrix set (Plato's Key) lets you replace the heavy Qwen3-VL-32B text encoder in the MiniMax H3 video model with lighter and more accessible Qwen3-VL-2B-Instruct or Qwen3-VL-4B-Instruct models. The transformation is computed via ridge regression (a regularization method to prevent overfitting) and accurately projects donor hidden states to the 32B version's dimensionality. The solution targets users of the H3cApp application on Mac who want to lower hardware requirements during generation. Base model tokenizers are identical, preserving correct operation with MiniMax H3 special tags.
Key features
- Tokenizer compatibility: Qwen3-VL-2B, 4B, and 32B use identical tokenizer files with support for MiniMax H3 dialog tags.
- Weight reduction: Versions are available for encoder sizes of 42 MB (2B) and 52 MB (4B), plus a multi-layer variant at 210 MB.
- Precise transfer: The method uses ridge regression (a regularization method to prevent overfitting) with mean correction.
- Open script: Includes a reference Python implementation for manual extraction of hidden states.
What you can do
- Running in H3cApp: Connect projection keys to the Mac app (Apple silicon) along with the original Qwen3-VL model folder.
- Pipeline integration: Use the included
encode_prompt.pyscript to compute text conditioning (generation conditions) for custom prompts. - Dialog generation: Pass text prompts with
andtags for precise control of character speech (for example, in Japanese).
Example
import json, torch
from safetensors import safe_open
from transformers import AutoTokenizer, Qwen3VLForConditionalGeneration
prompt = "..." # промпт для H3, включая теги
with safe_open("qwen3-vl/minimax_h3_32b_pk_ridge_qwen3vl_4b.safetensors", "pt") as f:
meta = f.metadata()
key = {name: f.get_tensor(name).float() for name in f.keys()}
tokenizer = AutoTokenizer.from_pretrained(meta["donor_model"])
model = Qwen3VLForConditionalGeneration.from_pretrained(meta["donor_model"], dtype=torch.bfloat16).eval()Read more
DetailsBenchmarks: average cosine similarity of sequences with the 32B model is 0.960 for 4B and 0.953 for 2B (0.973 for the multi-layer version).
Limitations: tested only in the H3cApp Mac application; compatibility with ComfyUI has not been verified.
License: Apache-2.0.














Comments