SeonghoonYu/Masking-KD-Rollouts
Viewer • Updated • 19.4k • 28
How to use SeonghoonYu/Masking-KD with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("image-text-to-text", model="SeonghoonYu/Masking-KD")
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 AutoProcessor, AutoModelForMultimodalLM
processor = AutoProcessor.from_pretrained("SeonghoonYu/Masking-KD")
model = AutoModelForMultimodalLM.from_pretrained("SeonghoonYu/Masking-KD", device_map="auto")
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?"}
]
},
]
inputs = processor.apply_chat_template(
messages,
add_generation_prompt=True,
tokenize=True,
return_dict=True,
return_tensors="pt",
).to(model.device)
outputs = model.generate(**inputs, max_new_tokens=256)
print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:]))How to use SeonghoonYu/Masking-KD with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "SeonghoonYu/Masking-KD"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "SeonghoonYu/Masking-KD",
"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 run hf.co/SeonghoonYu/Masking-KD
How to use SeonghoonYu/Masking-KD with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "SeonghoonYu/Masking-KD" \
--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": "SeonghoonYu/Masking-KD",
"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 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 "SeonghoonYu/Masking-KD" \
--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": "SeonghoonYu/Masking-KD",
"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"
}
}
]
}
]
}'How to use SeonghoonYu/Masking-KD with Docker Model Runner:
docker model run hf.co/SeonghoonYu/Masking-KD
Checkpoint for Hide to See: Reasoning-prefix Masking for Visual-anchored Thinking in VLM Distillation (NeurIPS 2026).
Qwen3-VL-2B-Thinking distilled from Qwen3-VL-8B-Thinking with Masking-KD.
Paper: https://arxiv.org/abs/2605.11651 | Code: https://github.com/Seonghoon-Yu/Masking-KD
| Student / Teacher | Qwen3-VL-2B-Thinking / Qwen3-VL-8B-Thinking |
| Data | SeonghoonYu/Masking-KD-Rollouts: 19,387 correct greedy teacher rollouts on ViRL39K |
| Schedule | 2 epochs (76 steps), global batch size 512, learning rate 1e-6 |
The model was trained with the reasoning instruction below appended to each question.
from transformers import AutoModelForImageTextToText, AutoProcessor
model = AutoModelForImageTextToText.from_pretrained("SeonghoonYu/Masking-KD", dtype="auto", device_map="auto")
processor = AutoProcessor.from_pretrained("SeonghoonYu/Masking-KD")
question = "Find x."
instruction = (
"You first think through the reasoning process as an internal monologue, enclosed within <think> </think> tags. "
"Then, provide your final answer enclosed within \\boxed{}."
)
messages = [{
"role": "user",
"content": [
{"type": "image", "image": "path/to/image.png"},
{"type": "text", "text": f"{question}\n\n{instruction}"},
],
}]
inputs = processor.apply_chat_template(
messages, tokenize=True, add_generation_prompt=True, return_dict=True, return_tensors="pt"
).to(model.device)
outputs = model.generate(**inputs, max_new_tokens=4096, do_sample=False)
print(processor.decode(outputs[0, inputs["input_ids"].shape[1]:], skip_special_tokens=True))
To reproduce the benchmark evaluation (Geo3K, MathVista, We-Math, MMK12, MathVerse, LogicVista, MMMU-Pro):
git clone https://github.com/Seonghoon-Yu/Masking-KD && cd Masking-KD
python evaluation/prepare_data.py
bash scripts/eval.sh SeonghoonYu/Masking-KD
@inproceedings{yu2026hide,
title = {Hide to See: Reasoning-prefix Masking for Visual-anchored Thinking in VLM Distillation},
author = {Yu, Seonghoon and Nam, Dongjun and Lee, Byung-Kwan and Son, Jeany},
booktitle = {Advances in Neural Information Processing Systems (NeurIPS)},
year = {2026}
}
Base model
Qwen/Qwen3-VL-2B-Thinking