Run this model with HF Jobs

Run Skywalker0410/ZoomLynx on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.

Paste one of these prompts into your coding agent:

Fine-tune on my dataset

Use HF Jobs and TRL to fine-tune https://huggingface.co/Skywalker0410/ZoomLynx. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.

Run batch inference

Use HF Jobs to run batch inference with https://huggingface.co/Skywalker0410/ZoomLynx on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.

Evaluate on a benchmark

Use HF Jobs to evaluate https://huggingface.co/Skywalker0410/ZoomLynx. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.

Quantize for lower memory use

Use HF Jobs to create a 4-bit version of https://huggingface.co/Skywalker0410/ZoomLynx. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.

ZoomLynx ZoomLynx: Learning to Zoom In on What Matters

English | 简体中文

ZoomLynx compares object positions, reads signs and recovers from a missed crop.

🔗 Quick Links

📰 News

  • Code [12/01/2026] · The GitHub repository now includes inference, training and evaluation code. See the project page for examples.
  • Model [11/30/2026] · The ZoomLynx-M2 weights are available on Hugging Face.
  • Benchmark [11/30/2026] · Aperture-580 is available with 580 annotated questions and tools to fetch the evaluation images.
  • Paper [11/30/2026] · Read the ZoomLynx paper on arXiv or download the PDF.

Model Overview

Description

ZoomLynx is a 4B visual reasoning agent for high-resolution images. With one zoom tool, it learns when to inspect a detail, where to look, and when to stop. It can answer from the full image, zoom in to gather evidence, or abstain if the image cannot resolve the question. The checkpoint released here is ZoomLynx-M2, trained with supervised fine-tuning (SFT). Aperture-580 evaluates both its answers and the observations it chooses to make.

License/Terms of Use

ZoomLynx weights and project code use Apache 2.0. The base model and separately downloaded super-resolution weights retain their upstream notices. License and upstream credits

Citation

Model Architecture

Selective Zoom Training starts from Qwen3-VL-4B-Instruct and produces the full BF16 M2 checkpoint. Training examples cover direct answers, necessary zooms, comparisons across regions, recovery from a missed crop, and abstention. On repaired trajectories, the failed call and the image the model actually saw remain in the context. A teacher continues from that observation, and the corrected continuation supplies the supervision. M2 is the common starting point for two independent experiments, M3 with DPO and M4 with GSPO.

Selective Zoom Training and the DPO and GSPO branches from M2.

How it works. The agent calls zoom_and_super_resolve with a visible image and a bounding box. The executor returns a lossless Raw Crop and, for eligible small regions, a 2× or 4× Real-ESRGAN SR Crop. The enhanced view helps with inspection. Factual details such as letters must be supported by the raw pixels. If a crop misses, the agent can return to the original image and select another region. Each question allows three tool attempts, including rejected calls.

Inputs and Outputs

Interface What to provide or read
Input One image file and one question. The local runner accepts English or Chinese with --lang en or --lang zh.
Zoom request image_idx selects the original (0) or a returned view. bbox_2d is an integer box [x1, y1, x2, y2] in 0–1000 coordinates relative to that view. The client executes the crop and sends the resulting pixels back to the model.
Terminal response A single JSON object carries action (answer or stop) and an answer string. The scorer reads the text inside <answer>…</answer>. A stop also supplies a reason, such as insufficient_visual_evidence.
Local output runs/demo/trace.json contains status, answer, n_tool_calls, turns, and messages. Generated crops are written as PNGs beside it.

Inference

Environment

Use Linux, Python 3.10 and a BF16-capable accelerator. The release runner uses Transformers 4.57.1 with the included processor, chat template and prompts. Download both BF16 shards (9.65 GB in total) with Git LFS, or place an existing full download in ~/zoomlynx-run/weights.

mkdir -p "$HOME/zoomlynx-run"
cd "$HOME/zoomlynx-run"
GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/Skywalker0410/ZoomLynx weights
git -C weights lfs pull

The example runs on one CUDA device using the teaser image bundled with this card. Replace the image path and question to use your own image.

cd "$HOME/zoomlynx-run"
python3.10 -m venv .local-env
source .local-env/bin/activate
cd weights
python -m pip install "torch==2.5.1" "torchvision==0.20.1"
python -m pip install -r requirements-inference.txt
python agent/infer.py --weights . --image assets/teaser.png \
  --question "What color is the umbrella in the beach scene?" --lang en --device cuda:0 --out runs/demo

Run this in the same directory to read the terminal status, number of zoom calls and short answer.

python - <<'PY'
import json, re
from pathlib import Path

trace = json.loads(Path("runs/demo/trace.json").read_text(encoding="utf-8"))
short = re.search(r"<answer>(.*?)</answer>", trace["answer"] or "", re.S)
print(trace["status"], trace["n_tool_calls"], short.group(1).strip() if short else "")
PY

For example, the checkpoint’s recorded local run on Aperture-580 item zf_0090 ended with answer, two zoom calls and the text DUCK TAPE. The local agent uses greedy decoding, up to four model turns and 1,024 new tokens per turn by default. Start the SR service below to enable enhanced crops. When that service is unavailable, the executor can still return the raw crop. Local agent · Tool contract

Inference Infrastructure

For persistent serving, vLLM runs the model, Real-ESRGAN enhances small crops, and the client drives the conversation. The client calls /v1/chat/completions, executes each requested crop, appends the returned images, and requests another turn until the model answers or stops.

Service environment

Use the downloaded weights above and a separate Python 3.12 environment for the services.

cd "$HOME/zoomlynx-run"
git clone https://github.com/Skywalker-yqz/ZoomLynx.git code
python3.12 -m venv .serve-env
source .serve-env/bin/activate
python -m pip install "vllm==0.15.0" "pydantic>=2" fastapi uvicorn numpy pillow requests

Model server

Start vLLM on GPU 0. The paper uses BF16, tensor parallelism 1, a 49,152-token context, 0.85 GPU memory utilization and the Hermes tool parser. For evaluation, the client uses greedy decoding (temperature 0, top-p 1.0) with up to 2,048 new tokens per turn. Serving and decoding settings, Table 14

cd "$HOME/zoomlynx-run/code"
source ../.serve-env/bin/activate
MODEL="$HOME/zoomlynx-run/weights" SERVED_NAME=zoomlynx PORT=8000 \
  CUDA_VISIBLE_DEVICES=0 TP=1 GPU_MEM=0.85 MAX_LEN=49152 MAX_NUM_SEQS=64 MAX_IMAGES=40 \
  bash inference/serve_vllm.sh

Super-resolution service

In a second terminal, start Real-ESRGAN on GPU 1. On a one-GPU host, replace CUDA_VISIBLE_DEVICES=1 DEVICE=cuda DTYPE=fp16 with DEVICE=cpu DTYPE=fp32 to run SR on the CPU.

cd "$HOME/zoomlynx-run/code"
source ../.serve-env/bin/activate
export SR_MODEL_DIR="$PWD/weights/RealESRGAN"
bash scripts/download_sr_weights.sh "$SR_MODEL_DIR"
CUDA_VISIBLE_DEVICES=1 DEVICE=cuda DTYPE=fp16 MAX_CONCURRENCY=2 \
  bash tool_servers/sr/start.sh --host 127.0.0.1 --port 9049

Client request

In a third terminal, check the endpoints and ask one question. The HTTP client’s default protocol uses the Chinese system prompt. For the English protocol, follow the prompt guide.

cd "$HOME/zoomlynx-run/code"
source ../.serve-env/bin/activate
curl -fsS http://127.0.0.1:8000/v1/models
curl -fsS http://127.0.0.1:9049/health
python inference/run_demo.py --image ../weights/assets/teaser.png \
  --question "海滩场景中,遮阳伞是什么颜色的?" --model zoomlynx \
  --base-url http://127.0.0.1:8000/v1 --sr-url http://127.0.0.1:9049/v1/sr/upscale \
  --output-dir runs/http-demo

The HTTP demo prints the short answer and writes runs/http-demo/trace.json with messages and terminal. For a stopped episode, inspect terminal.reason.

Setting What it controls
TP=1 GPUs sharing one model. For two model GPUs, use CUDA_VISIBLE_DEVICES=0,1 TP=2 and assign SR to another device or the CPU.
MAX_NUM_SEQS=64, MAX_IMAGES=40 vLLM’s maximum concurrent sequences and maximum images per prompt. Returned crop views count toward the image limit.
MAX_CONCURRENCY=2 Number of simultaneous SR requests. Batch client workers share the model and SR endpoints.

Batch Workers

Keep both services running. Each worker handles one question through its entire tool loop. The example uses eight client threads and the original Chinese Aperture-580 test set. Set --images to your local image directory matched to the dataset manifest. The converter writes absolute image paths for the workers.

Batch evaluation commands · Bash
cd "$HOME/zoomlynx-run"
source .serve-env/bin/activate
git clone https://huggingface.co/datasets/Skywalker0410/Aperture-580 benchmark
python benchmark/tools/make_eval_jsonl.py --lang zh \
  --images /path/to/matched-images --out runs/ap580-zh.jsonl
python code/eval/run_agent_eval.py --benchmark runs/ap580-zh.jsonl \
  --base-url http://127.0.0.1:8000/v1 --model zoomlynx \
  --sr-url http://127.0.0.1:9049/v1/sr/upscale --workers 8 \
  --max-new-tokens 2048 --output-dir runs/ap580-m2 --resume
python code/eval/summarize.py --benchmark runs/ap580-zh.jsonl \
  --rollout runs/ap580-m2/rollout.jsonl --out runs/ap580-m2/summary.json

rollout.jsonl has one row per question, including sample_id, final_answer, status, n_tool_calls, score, and trace_path. Rerun the evaluation command with the same output directory and --resume to skip recorded IDs. The summary reports string-match accuracy, tool-use rate and mean calls. For open-ended Chinese answers, the paper used GPT-5.5 equivalence judgments and audited Stop decisions separately. Evaluation and scoring

Evaluation

The released M2 (SFT) checkpoint scores 60.95% on ZoomBench, 93.72% on V*Bench, and 71.55% on Aperture-580 with the three-call Agent protocol. It abstains appropriately on 59 of the 74 unanswerable Aperture-580 questions.

The paper also reports a separate M4 (GSPO) result. With access to the zoom tool, M4 scores 61.18% on ZoomBench and 94.24% on V*Bench. Both scores exceed the GPT-5.5 and Gemini-3.1-pro results in the paper’s Direct setting, where the models answer without tools. Benchmark results, Table 1

Accuracy of M2, M4 and the leading baselines on seven benchmarks.

ZoomBench · HR-Bench 4K · HR-Bench 8K · V*Bench · ActiView · MME-RealWorld-Lite · Aperture-580

Cross-View Example

ZoomLynx trained on single-image tasks. In this zero-shot MMSI-Bench example, it can select either of two views at inference. The first crop shows the piano, the second shows a doorframe, and the third finds the table under the mirror in the other view. ZoomLynx correctly answers that the table is longer.

ZoomLynx compares the piano and table across views after a crop misses the table.


ZoomLynx ZoomLynx:学会放大图像中的关键信息

English | 简体中文

ZoomLynx 比较物体位置、辨认路牌,并在裁剪偏离目标后重新定位。

🔗 快速链接

📰 最新动态

  • 代码 [12/01/2026] · 推理、训练和评测代码已在 GitHub 发布。模型示例见项目主页。
  • 模型 [11/30/2026] · ZoomLynx-M2 权重已在 Hugging Face 发布。
  • 评测集 [11/30/2026] · Aperture-580 已发布,包含 580 道题的标注和评测原图下载工具。
  • 论文 [11/30/2026] · ZoomLynx 论文已在 arXiv 发布,可下载 PDF。

模型概览

简介

ZoomLynx 是面向高分辨率图像的 4B 视觉推理智能体。它只有一种缩放工具,需要判断何时查看局部、去哪里取证,以及何时结束观察。全图足以回答时,它可以直接作答。需要细节时,它可以选区放大,证据不足时也可以弃答。本仓库发布的是经过监督微调(SFT)的 ZoomLynx-M2。Aperture-580 同时评测模型的答案和获取证据的过程。

许可与使用条款

ZoomLynx 权重与项目代码采用 Apache 2.0。基础模型与另行获取的超分辨率权重保留各自的上游声明。许可与上游署名

引用

模型架构

M2 是以 Qwen3-VL-4B-Instruct 为基础,经选择性缩放训练得到的完整 BF16 权重。训练样本覆盖直接作答、必要的局部观察、跨区域取证、裁剪失误后的纠正,以及证据不足时的弃答。对于需要纠正的轨迹,模型失败的调用和它实际看到的裁剪图会保留在上下文中。教师模型从这一观察结果继续推理,监督信号只施加在纠正后的后续步骤上。论文另以 M2 为共同起点,分别通过 DPO 得到 M3、通过 GSPO 得到 M4。

选择性缩放训练,以及从 M2 出发的 DPO 和 GSPO 两个分支。

工作方式。 智能体调用 zoom_and_super_resolve,指定当前可见的图像和要查看的区域。执行器返回无损的原始裁剪(Raw Crop)。若小区域满足放大条件,还会返回 2× 或 4× 的 Real-ESRGAN 超分辨率视图(SR Crop)。超分图辅助观察,辨认文字等细节时以原始像素为准。裁剪偏离目标后,模型可以回到原图重新选区。每题最多尝试调用三次,被拒绝的调用也计入预算。

输入与输出

接口 输入或返回值
输入 一张图片和一个问题。本地脚本通过 --lang zh 或 --lang en 选择与提问语言对应的提示词。
缩放请求 image_idx 指定原图(0)或前面返回的视图。bbox_2d 采用整数坐标 [x1, y1, x2, y2],相对于当前所选视图归一化至 0–1000。客户端负责裁剪并将图像回传模型。
终止响应 最终返回一个 JSON 对象,包含 action(answer 或 stop)和 answer 字符串。评分时读取 <answer>…</answer> 中的简短答案。stop 还须给出 reason,例如 insufficient_visual_evidence(视觉证据不足)。
本地输出 runs/demo/trace.json 记录 status、answer、n_tool_calls、turns 和 messages。生成的裁剪图以 PNG 格式保存在同一目录。

推理部署

环境

使用 Linux、Python 3.10 和支持 BF16 的加速卡。本地脚本基于 Transformers 4.57.1,使用权重包内的处理器、对话模板与提示词。用 Git LFS 获取两个 BF16 分片(合计 9.65 GB),也可以把已完整下载的模型放在 ~/zoomlynx-run/weights。

mkdir -p "$HOME/zoomlynx-run"
cd "$HOME/zoomlynx-run"
GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/Skywalker0410/ZoomLynx weights
git -C weights lfs pull

下面的例子用单张 CUDA 卡和模型卡自带的 Teaser 图片运行。替换图片路径和问题即可测试自己的图像。

cd "$HOME/zoomlynx-run"
python3.10 -m venv .local-env
source .local-env/bin/activate
cd weights
python -m pip install "torch==2.5.1" "torchvision==0.20.1"
python -m pip install -r requirements-inference.txt
python agent/infer.py --weights . --image assets/teaser.png \
  --question "海滩场景中,遮阳伞是什么颜色的?" --lang zh --device cuda:0 --out runs/demo

在同一目录运行以下命令,读取终止状态、缩放调用次数和简短答案。

python - <<'PY'
import json, re
from pathlib import Path

trace = json.loads(Path("runs/demo/trace.json").read_text(encoding="utf-8"))
short = re.search(r"<answer>(.*?)</answer>", trace["answer"] or "", re.S)
print(trace["status"], trace["n_tool_calls"], short.group(1).strip() if short else "")
PY

例如,权重包记录的 Aperture-580 样本 zf_0090 本地推理在两次缩放后返回了 answer,简短答案为 DUCK TAPE。本地脚本默认采用贪心解码,最多生成四轮,每轮最多 1,024 个新 token。启动下文的超分辨率服务即可获得增强视图。服务不可用时,执行器仍可返回原始裁剪。本地脚本 · 工具协议

推理基础设施

常驻部署由三个部分组成。vLLM 运行模型,Real-ESRGAN 为小区域提供超分辨率视图,客户端负责串起多轮观察。客户端向 /v1/chat/completions 发送请求,按模型返回的参数裁剪图像,把新视图加入对话,再次请求模型,直到作答或弃答。

服务环境

使用上文下载的权重,并为服务单独创建 Python 3.12 环境。

cd "$HOME/zoomlynx-run"
git clone https://github.com/Skywalker-yqz/ZoomLynx.git code
python3.12 -m venv .serve-env
source .serve-env/bin/activate
python -m pip install "vllm==0.15.0" "pydantic>=2" fastapi uvicorn numpy pillow requests

模型服务

在 GPU 0 上启动 vLLM。论文使用 BF16、张量并行度 1、49,152 token 上下文、0.85 显存占用比例和 Hermes 工具调用解析器。评测客户端采用贪心解码(temperature 0、top-p 1.0),每轮最多生成 2,048 个新 token。服务与解码参数,表 14

cd "$HOME/zoomlynx-run/code"
source ../.serve-env/bin/activate
MODEL="$HOME/zoomlynx-run/weights" SERVED_NAME=zoomlynx PORT=8000 \
  CUDA_VISIBLE_DEVICES=0 TP=1 GPU_MEM=0.85 MAX_LEN=49152 MAX_NUM_SEQS=64 MAX_IMAGES=40 \
  bash inference/serve_vllm.sh

超分辨率服务

在第二个终端使用 GPU 1 启动 Real-ESRGAN。只有一张 GPU 时,可将 CUDA_VISIBLE_DEVICES=1 DEVICE=cuda DTYPE=fp16 替换为 DEVICE=cpu DTYPE=fp32,在 CPU 上运行超分辨率。

cd "$HOME/zoomlynx-run/code"
source ../.serve-env/bin/activate
export SR_MODEL_DIR="$PWD/weights/RealESRGAN"
bash scripts/download_sr_weights.sh "$SR_MODEL_DIR"
CUDA_VISIBLE_DEVICES=1 DEVICE=cuda DTYPE=fp16 MAX_CONCURRENCY=2 \
  bash tool_servers/sr/start.sh --host 127.0.0.1 --port 9049

客户端请求

在第三个终端检查两个服务并发送一道问题。HTTP 客户端的默认协议使用中文系统提示词。英文问题的协议配置见提示词指南。

cd "$HOME/zoomlynx-run/code"
source ../.serve-env/bin/activate
curl -fsS http://127.0.0.1:8000/v1/models
curl -fsS http://127.0.0.1:9049/health
python inference/run_demo.py --image ../weights/assets/teaser.png \
  --question "海滩场景中,遮阳伞是什么颜色的?" --model zoomlynx \
  --base-url http://127.0.0.1:8000/v1 --sr-url http://127.0.0.1:9049/v1/sr/upscale \
  --output-dir runs/http-demo

HTTP 客户端会打印简短答案,并在 runs/http-demo/trace.json 中写入 messages 和 terminal。弃答原因见 terminal.reason。

配置 含义
TP=1 分担同一份模型权重的 GPU 数。双卡张量并行可设 CUDA_VISIBLE_DEVICES=0,1 TP=2,并将超分辨率服务放在其他设备或 CPU 上。
MAX_NUM_SEQS=64、MAX_IMAGES=40 vLLM 同时处理的最大序列数和每个提示允许的最大图像数。每次返回的裁剪视图也计入图像数。
MAX_CONCURRENCY=2 超分辨率服务可同时处理的请求数。批量推理的各个 worker 共用模型和超分辨率服务。

批量评测 Worker

保持两个服务运行。每个 worker 负责一道题的完整多轮观察过程。下面用八个客户端线程运行 Aperture-580 中文原题。将 --images 替换为按图像清单 匹配好的本地目录,转换脚本会写出供 worker 使用的图像绝对路径。

批量评测命令 · Bash
cd "$HOME/zoomlynx-run"
source .serve-env/bin/activate
git clone https://huggingface.co/datasets/Skywalker0410/Aperture-580 benchmark
python benchmark/tools/make_eval_jsonl.py --lang zh \
  --images /path/to/matched-images --out runs/ap580-zh.jsonl
python code/eval/run_agent_eval.py --benchmark runs/ap580-zh.jsonl \
  --base-url http://127.0.0.1:8000/v1 --model zoomlynx \
  --sr-url http://127.0.0.1:9049/v1/sr/upscale --workers 8 \
  --max-new-tokens 2048 --output-dir runs/ap580-m2 --resume
python code/eval/summarize.py --benchmark runs/ap580-zh.jsonl \
  --rollout runs/ap580-m2/rollout.jsonl --out runs/ap580-m2/summary.json

rollout.jsonl 每题一行,包括 sample_id、final_answer、status、n_tool_calls、score 和 trace_path。继续评测时,使用相同的输出目录和 --resume,即可跳过已记录的样本 ID。汇总脚本报告字符串匹配准确率、工具使用率和平均调用次数。论文对中文开放式答案采用 GPT-5.5 判断答案是否等价,并单独评估弃答行为。评测与计分

评测

在每题最多调用三次工具的 Agent 设置下,本仓库发布的 M2(SFT) 在 **ZoomBench 上达到 60.95%**,在 **V*Bench 上达到 93.72%**,在 **Aperture-580 上达到 71.55%**。Aperture-580 有 74 道无法凭图像可靠作答的问题,M2 在其中 59 道上正确弃答。

论文还单独报告了 M4(GSPO) 的结果。M4 使用缩放工具,在 **ZoomBench 上达到 61.18%**,在 **V*Bench 上达到 94.24%**。作为对照,GPT-5.5 和 Gemini-3.1-pro 在论文的 Direct 设置下直接看图作答,不调用工具。M4 在这两项基准上的分数均高于这两个对照模型。基准结果,表 1

M2、M4 与领先基线在七项基准上的准确率。

ZoomBench · HR-Bench 4K · HR-Bench 8K · V*Bench · ActiView · MME-RealWorld-Lite · Aperture-580

跨视角示例

ZoomLynx 的训练任务使用单张图像。在这个来自 MMSI-Bench 的零样本示例中,模型在推理时可以从两个视角中选区。第一处裁剪找到了钢琴,第二处只看到门框,第三次切换到另一个视角,找到了镜子下方的桌子。模型据此正确判断桌子更长。

一次裁剪偏离桌子后,ZoomLynx 切换视角,比较钢琴和桌子的长度。

Downloads last month
103
Safetensors
Model size
4B params
Tensor type
BF16
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for Skywalker0410/ZoomLynx

Finetuned
(591)
this model

Space using Skywalker0410/ZoomLynx 1

Paper for Skywalker0410/ZoomLynx