Fewer Tokens, More Self-Teaching: On-Policy Self-Distillation for Extreme Visual Token Reduction
Paper • 2609.32353 • Published • 8
How to use yyy051007/LT-OPD with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("image-text-to-text", model="yyy051007/LT-OPD")
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("yyy051007/LT-OPD")
model = AutoModelForMultimodalLM.from_pretrained("yyy051007/LT-OPD", 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 yyy051007/LT-OPD with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "yyy051007/LT-OPD"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "yyy051007/LT-OPD",
"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/yyy051007/LT-OPD
How to use yyy051007/LT-OPD with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "yyy051007/LT-OPD" \
--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": "yyy051007/LT-OPD",
"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 "yyy051007/LT-OPD" \
--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": "yyy051007/LT-OPD",
"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 yyy051007/LT-OPD with Docker Model Runner:
docker model run hf.co/yyy051007/LT-OPD
LT-OPD trains vision-language models with fewer visual tokens through on-policy self-distillation. This Qwen3.5-4B model combines CDPruner with an MLP that aggregates discarded tokens into their nearest retained tokens, preserving their original positions without adding tokens.
Use Python 3.12 and the CUDA environment in the installation guide.
git clone --depth 1 https://github.com/Yrxxxxxxxx1007/LT-OPD.git
cd LT-OPD
pip install torch==2.10.0 torchvision==0.25.0 --index-url https://download.pytorch.org/whl/cu126
pip install -e '.[eval]'
pip install flash-attn==2.8.3 --no-build-isolation
hf download yyy051007/LT-OPD \
--local-dir models/LT-OPD
Load the model with LT-OPD's visual-token compression runtime:
import torch
from evaluation.runtime import build_route_query
from lt_opd import load_compression_runtime
runtime = load_compression_runtime(
"models/LT-OPD",
implementation="current",
torch_dtype=torch.bfloat16,
device_map={"": "cuda:0"},
)
question = "What is written on the sign?"
messages = [{
"role": "user",
"content": [
{"type": "image", "image": "/path/to/image.jpg"},
{"type": "text", "text": question},
],
}]
output = runtime.generate(
[messages],
route_queries_batch=[build_route_query(question)],
)
print(output["decoded_predictions"][0])
If you find our code, model, or dataset useful, please kindly cite our paper:
@article{li2026fewer,
title={Fewer Tokens, More Self-Teaching: On-Policy Self-Distillation for Extreme Visual Token Reduction},
author={Li, Junxian and Yang, Ruixuan and Zhang, Tianao and Xu, Tiange and Dong, Weisheng and Zhang, Yulun},
journal={arXiv preprint arXiv:2609.32353},
year={2026}
}