--- license: apache-2.0 language: - en pretty_name: InSight-doc-SFT-18k task_categories: - visual-question-answering - question-answering tags: - document-vqa - long-document-understanding - multimodal - agentic-ai - tool-use - qwen3-vl - supervised-fine-tuning size_categories: - 10K InSight-doc logo

Agentic Visual Perception for Long-Document Understanding

📄 **[Paper](https://arxiv.org/abs/2608.10628)** | 💻 **[Code](https://github.com/m-Just/InSight-doc)** | 🤗 **[Model](https://huggingface.co/InSight-doc/InSight-doc-8B)** | 🎯 **[RL Data](https://huggingface.co/datasets/m-Just/InSight-doc-RL-19k)** | 🎬 **[Replay Demo](https://vaynexie.github.io/insight-doc-demo-display/demo_display.html)** | 🚀 **[Live Demo](https://huggingface.co/spaces/leoyu112211/insight-doc-online-demo)**

Understand the big picture.  Focus on the right details.  Answer from the evidence.

**InSight-doc-SFT-18k** is the supervised fine-tuning corpus used to train the InSight-doc long-document understanding agent. Each example is a complete multimodal trajectory: the agent starts from low-resolution document pages, zooms into selected regions, observes the returned crops, and produces a final answer grounded in the visual evidence. ## Dataset Summary The dataset contains 17,913 supervised trajectories for a Qwen3-VL-style agent with an `image_zoom_in_tool`. The conversations include the user question, assistant tool calls, tool observations, and the final assistant answer. The release keeps the conversation, image, tool-schema, and source-label fields needed to reproduce the SFT setup. ## Example Trajectory The example below illustrates the coarse-to-fine supervision format: the agent starts from low-resolution page views, issues zoom-in calls for relevant regions, receives cropped observations, and answers from the collected evidence.

Example InSight-doc SFT trajectory

## Dataset Statistics | Statistic | Value | |---|---:| | Rows | 17,913 | | Answerable rows | 14,216 (79.36%) | | Unanswerable rows | 3,697 (20.64%) | | arXiv-derived rows | 8,115 | | Non-arXiv rows | 9,798 | | Mean document length | 17.75 pages | | Mean zoom-in tool calls | 1.61 | Resize ratios are relative to 200-DPI page renders: | Resize ratio `r` | Approx. DPI | Rows | Share | |---:|---:|---:|---:| | 0.25 | 50 | 10,051 | 56.1% | | 0.35 | 70 | 4,913 | 27.4% | | 0.50 | 100 | 2,949 | 16.5% | ## Data Fields | Field | Description | |---|---| | `id` | Stable row identifier in this release. | | `images` | Ordered images referenced by `messages`, including initial page views and tool-returned crops. | | `question` | Original user question. | | `messages` | Chat-format trajectory with `system`, `user`, `assistant`, and `tool` roles. Image references appear as `Image k:`. Assistant tool calls are stored inline in assistant message content. | | `num_tool_calls` | Number of zoom-in tool calls in the trajectory. | | `data_source` | Source/category label, including answerability. | | `tools` | OpenAI/Qwen-style schema for `image_zoom_in_tool`. Pass this to `apply_chat_template` when reconstructing model inputs. | The final answer is stored in the final assistant message in `messages`; there is no separate `answer` column in the SFT release. ## Dataset Construction The SFT data were produced by the InSight-doc data construction pipeline: 1. **Source QA collection.** The source pool combines non-arXiv document VQA data (MP-DocVQA, DUDE, poster QA, infographic QA, and map QA) with arXiv-derived scientific-document QA sources. 2. **Difficulty filtering.** For heterogeneous non-arXiv answerable rows, a low-resolution Qwen3-VL-8B filter removes questions that are already solved without zooming. All answerable sources then go through a stronger Qwen3-VL-32B no-zoom filter before trajectory generation. The arXiv rows are generated by an evidence-centric pipeline with explicit dependency checks, so they bypass the 8B gate but still use the 32B filter. 3. **Trajectory generation.** [InSight-o3](https://github.com/m-Just/InSight-o3) generates multi-turn zoom-in trajectories. The vReasoner identifies regions to inspect, the vSearcher localizes them, and the resulting crop is appended as a tool observation. Trajectories whose final answers match the reference answer are retained as SFT candidates. 4. **Unanswerable add-ons.** Naturally unanswerable DUDE/poster rows and verified synthetic unanswerable questions are included so the agent learns to abstain when the document does not contain sufficient evidence. 5. **Postprocessing.** Degenerate-trajectory removal drops malformed conversations, invalid tool arguments, missing answers, and unresolved image references. GPT-5-nano rewrites only the final assistant response from the [InSight-o3](https://github.com/m-Just/InSight-o3) "think + answer" style into a cleaner Qwen3-VL-Instruct-style final answer while preserving the tool trajectory. ## Trajectory Quality Evidence-based metrics are computed only on answerable examples with evidence annotations. Page and region hit rates also exclude trajectories with no crops. For region hit, a crop hits an evidence box when it covers at least 50% of that box. | Metric | Value | |---|---:| | Rows with page evidence | 13,335 | | Rows with box evidence | 6,925 | | Evidence-page hit rate | 95.33% | | Evidence-region hit rate, coverage >= 0.5 | 85.00% | | Mean max evidence coverage | 85.24% | | Mean max crop/evidence IoU | 52.37% | | Crop region-hit rate | 65.34% | | Crop area fraction | 14.50% | | Same-source overlap rate, IoU >= 0.8 | 3.16% | | Stuck rate | 0.99% | | Stop exactly at first region hit | 71.14% | ## Loading And Prompt Reconstruction ```python import copy import re from datasets import load_dataset from transformers import AutoProcessor def attach_images(messages, images): """Convert '' placeholders into Qwen3-VL image content items.""" messages = copy.deepcopy(messages) image_idx = 0 for message in messages: content = message.get("content") if not isinstance(content, str) or "" not in content: continue content_items = [] for part in re.split(r"()", content): if not part: continue if part == "": content_items.append({"type": "image", "image": images[image_idx]}) image_idx += 1 else: content_items.append({"type": "text", "text": part}) message["content"] = content_items assert image_idx == len(images), (image_idx, len(images)) return messages processor = AutoProcessor.from_pretrained( "Qwen/Qwen3-VL-8B-Instruct", trust_remote_code=True, ) row = load_dataset("m-Just/InSight-doc-SFT-18k", split="train[:1]")[0] messages = attach_images(row["messages"], row["images"]) prompt_text = processor.apply_chat_template( messages, tools=row["tools"], tokenize=False, add_generation_prompt=False, ) model_inputs = processor(text=[prompt_text], images=row["images"], return_tensors="pt") ``` ## License The InSight-doc-added annotations, tool-use trajectories, and packaging metadata are released under Apache-2.0. Source document images and source-derived content may remain subject to their original upstream licenses and terms. Users should review and respect the upstream terms where applicable. ## Citation ```bibtex @article{li2026insightdoc, title={InSight-doc: Agentic Visual Perception for Long-Document Understanding}, author={Li, Kaican and Xie, Weiyan and Yao, Lewei and Wu, Jiannan and Hong, Lanqing and Huang, Yongxiang and Zhang, Nevin L.}, journal={arXiv preprint arXiv:2608.10628}, year={2026} } ```