SII-zyj/Ophiuchus

Python

32

10 commits

updated May 15, 2026

See the code

README

Ophiuchus logo

Ophiuchus

Incentivizing Tool-augmented Thinking with Images for Medical Image Analysis

ICML 2026 Accepted · Tool-augmented medical MLLM · Think with images · Segmentation and zoom-in grounded reasoning

arXiv Paper PDF ICML 2026 Accepted GitHub Hugging Face Paper

GitHub stars GitHub forks DOI Models coming soon Dataset coming soon

If you find this project useful, please give us a star.


🎉 News


📌 Table of Contents


⚡ Introduction

Ophiuchus introduction

Ophiuchus is a tool-augmented medical multimodal large language model framework that learns to think with images. Instead of relying on a single global view, Ophiuchus performs iterative visual evidence acquisition during reasoning.

It learns to decide:

  • When additional visual evidence is needed.
  • Where to zoom, segment, and inspect fine-grained structures.
  • How to integrate localized visual observations into interleaved multimodal reasoning.

The core loop is simple and clinically motivated:

Thought → Tool Call → Observation → Grounded Reasoning → Final Answer

This allows Ophiuchus to inspect suspicious regions, verify uncertain hypotheses, and reduce hallucinations by grounding its answers in retrieved image evidence.


🧭 Why Ophiuchus

Medical image analysis often requires local evidence. Subtle lesions, boundaries, textures, and anatomical relationships may be missed by a single global image encoding. Ophiuchus addresses this limitation with an agentic visual reasoning process.

ChallengeOphiuchus response
Global views miss subtle findingsTargeted zoom-in retrieves fine-grained evidence
Bounding boxes can be unreliableText-driven segmentation delegates localization to external tools
Tool use may be unnecessary for easy casesThe model learns when to answer directly and when to inspect further
Visual hallucination can derail reasoningSelf-reflection and tool observations help the model correct itself
Medical tasks are diverseThe same framework supports VQA, detection, understanding, and reasoning-based segmentation

🔥 Key Highlights

  • ICML 2026 accepted medical AI framework for tool-augmented visual reasoning.
  • Three-tool agentic toolbox with SAM2, BiomedParse, and zoom-in operations.
  • 64K Tool-Integrated VQA trajectories with explicit tool use and visual grounding.
  • Three-stage training recipe:
    1. Cold-start supervised fine-tuning.
    2. Self-reflection fine-tuning.
    3. Agentic Tool Reinforcement Learning, ATRL.
  • Strong zero-shot generalization across medical VQA benchmarks.
  • Joint medical segmentation, understanding, and reasoning within one agentic framework.
  • Training-free tool transfer by replacing the segmentation tool while preserving the learned tool-use policy.

🧩 Framework Overview

Ophiuchus method

Ophiuchus is trained to produce interleaved multimodal reasoning traces:

Token or actionRole
<think>Textual reasoning and uncertainty assessment
<tool_call> or ActionInvoke image tools for segmentation or zoom-in
<obs>Inject tool outputs, masks, crops, or overlays into the context
Final answerProduce an answer grounded in accumulated visual evidence

The model is not only optimized for answer accuracy. It is also encouraged to use tools when evidence is missing, avoid unnecessary calls when the answer is clear, and correct itself when tool observations contradict earlier reasoning.


🧰 Toolbox

Ophiuchus uses three complementary tools.

ToolInputOutputBest used for
SAM2Bounding boxes proposed by the MLLMSegmentation masksFast region grounding when object location is roughly known
BiomedParseText promptsText-driven segmentation masksRobust localization when bounding boxes are uncertain
Zoom-InBounding boxes or masksCropped regions and optional contour overlaysFine-grained inspection of lesion morphology and boundaries

In practice, Ophiuchus learns to mix these tools according to case difficulty and the type of missing evidence.


🩺 Case Showcase

Below are representative qualitative cases. More details, captions, and examples are provided in the paper.

Visual cue search case

Pattern: the model recognizes that the global view is insufficient, calls segmentation to locate candidate regions, then zooms in to verify subtle visual cues before answering.

2. Confirmation via Zoom-In

Confirmation case

Pattern: after forming a tentative hypothesis, the model performs targeted zoom-ins to confirm key visual signatures and reduce uncertainty.

3. Hallucination Mitigation

Hallucination mitigation case

Pattern: the model detects a mismatch between textual reasoning and visual evidence, invokes tools again, and revises the answer with better grounding.


🏁 Results

Performance comparison on medical VQA benchmarks. Gray-shaded rows denote large-sized models. Bold and underlined indicate the best and second-best results. Improvement denotes the absolute gain of Ophiuchus over Qwen2.5-VL-7B without tool use. Avg. is the arithmetic mean over seven out-of-domain zero-shot benchmarks. Since Med-R1-2B is trained on part of the OmniMedVQA test set, its Avg. is computed over the remaining six benchmarks.

Ophiuchus benchmark results

🧪 Data Preparation

This repository provides training scripts and a minimal data format example.

SFT data: tool-integrated trajectories

A minimal example is provided here:

./data/example/data_case/biomedparser-SFT.json

RL data: one-case schema example

RL data is a list of records. A simplified case schema is shown below.

{
  "question_id": 1,
  "question_type": "multiple choice | segmentation | open-ended | yes/no",
  "question": "string (the prompt/question)",
  "answer": "string (GT label or text answer)",
  "options": ["string list (only for MCQ / constrained answers)"],
  "data_type": "vqa | seg",
  "image_path": ["string list (one or multiple images)"],
  "source": "string (e.g., BioMedParse)",
  "mask_path": ["string list (only for seg tasks, optional)"],
  "max_steps": 6
}

🏋️ Training

Installation for verl

# Please install verl from our repository.
# This helps visualize reward-component trends during training.
conda create -n verl-agent python==3.12 -y
conda activate verl-agent

pip3 install torch==2.6.0 --index-url https://download.pytorch.org/whl/cu124
pip3 install flash-attn==2.7.4.post1 --no-build-isolation

pip3 install -e .
pip3 install vllm==0.8.5

Install Toolbox Environments

Important: To run an agent with external tools, install and configure the corresponding tool environment first. We recommend installing each tool in a separate conda environment to avoid package conflicts.

1. SAM2 environment

SAM2 requires python>=3.10, torch>=2.5.1, and torchvision>=0.20.1. Please follow the official PyTorch instructions to install PyTorch and TorchVision.

cd ./examples/env_server/sam2/sam2
pip install -e .

Download model checkpoints:

cd ./examples/env_server/sam2/checkpoints && \
./download_ckpts.sh && \
cd ..

Individual checkpoints:

2. BiomedParse environment

Create a dedicated environment:

cd ./examples/env_server/BiomedParse/BiomedParse-main
conda create -n biomedparse python=3.9.19
conda activate biomedparse

Install PyTorch:

conda install pytorch torchvision torchaudio pytorch-cuda=12.4 -c pytorch -c nvidia

Install dependencies:

pip install -r assets/requirements/requirements.txt

Please download the Hugging Face model openai/clip-vit-base-patch32 into /openai/clip-vit-base-patch32, and download microsoft/BiomedNLP-BiomedBERT-base-uncased-abstract-fulltext into BiomedParse-main/microsoft/BiomedNLP-BiomedBERT-base-uncased-abstract-fulltext.

Start training

First, run cold-start SFT and self-reflection fine-tuning. Please specify configurations in:

/scripts/SFT/cold-start/my_qwen2_5vl_lora_sft.yaml
/scripts/SFT/reflective_rejection_fine_tuning/config_reflective.yaml

Update the dataset and model_name_or_path fields before training.

Stage A: Cold-start SFT

bash ./scripts/SFT/cold-start/train_cold_start.sh

Stage B: Self-reflection fine-tuning

bash ./scripts/SFT/reflective_rejection_fine_tuning/train_reflective.sh

Stage C: Agentic Tool RL, ATRL

Start the external toolbox first as local API services.

Start the SAM2 server:

bash ./examples/env_server/start_sam2_server.sh

Start the BiomedParse server:

bash ./examples/env_server/start_biomedparse_server.sh

Run GRPO training:

# Customize training parameters according to available hardware to avoid OOM.
bash ./examples/grpo_trainer/run_ATRL.sh

🤔 Model

ModelBase modelCheckpointGPU memory
OphiuchusQwen2.5-VL-7BComing soon17GB

🧑‍⚖️ Evaluation

Detailed evaluation instructions will be updated with the full release. The current release focuses on training scripts, tool environments, and the minimal data schema.


🐎 TODO

  • Announce ICML 2026 acceptance.
  • Add arXiv, PDF, GitHub, and Hugging Face paper links.
  • Release model checkpoints on Hugging Face.
  • Release the dataset on Hugging Face.
  • Add complete evaluation scripts and reproduction commands.
  • Add more qualitative examples and captions.
  • Update citation statistics after indexing.

🙏 Acknowledgement

We gratefully acknowledge the inspiring work of VERL, verl-agent, SAM2, and BioMedParse. These projects provided essential foundations and inspiration for Ophiuchus. We also thank the open-source community for building the tools that make reproducible medical AI research possible.


📈 Citation

If Ophiuchus helps your research, please cite our paper and star the repository. Citation statistics will be updated after indexing by major academic search engines.

Star History Chart
@misc{jiang2025incentivizing,
  title         = {Incentivizing Tool-augmented Thinking with Images for Medical Image Analysis},
  author        = {Yankai Jiang and Yujie Zhang and Peng Zhang and Yichen Li and Jintai Chen and Xiaoming Shi and Shihui Zhen},
  year          = {2025},
  eprint        = {2512.14157},
  archivePrefix = {arXiv},
  primaryClass  = {cs.AI},
  doi           = {10.48550/arXiv.2512.14157}
}

SII-zyj/Ophiuchus

Python

32

10 commits

updated May 15, 2026

See the code

README

Ophiuchus logo

Ophiuchus

Incentivizing Tool-augmented Thinking with Images for Medical Image Analysis

ICML 2026 Accepted · Tool-augmented medical MLLM · Think with images · Segmentation and zoom-in grounded reasoning

arXiv Paper PDF ICML 2026 Accepted GitHub Hugging Face Paper

GitHub stars GitHub forks DOI Models coming soon Dataset coming soon

If you find this project useful, please give us a star.


🎉 News


📌 Table of Contents


⚡ Introduction

Ophiuchus introduction

Ophiuchus is a tool-augmented medical multimodal large language model framework that learns to think with images. Instead of relying on a single global view, Ophiuchus performs iterative visual evidence acquisition during reasoning.

It learns to decide:

  • When additional visual evidence is needed.
  • Where to zoom, segment, and inspect fine-grained structures.
  • How to integrate localized visual observations into interleaved multimodal reasoning.

The core loop is simple and clinically motivated:

Thought → Tool Call → Observation → Grounded Reasoning → Final Answer

This allows Ophiuchus to inspect suspicious regions, verify uncertain hypotheses, and reduce hallucinations by grounding its answers in retrieved image evidence.


🧭 Why Ophiuchus

Medical image analysis often requires local evidence. Subtle lesions, boundaries, textures, and anatomical relationships may be missed by a single global image encoding. Ophiuchus addresses this limitation with an agentic visual reasoning process.

ChallengeOphiuchus response
Global views miss subtle findingsTargeted zoom-in retrieves fine-grained evidence
Bounding boxes can be unreliableText-driven segmentation delegates localization to external tools
Tool use may be unnecessary for easy casesThe model learns when to answer directly and when to inspect further
Visual hallucination can derail reasoningSelf-reflection and tool observations help the model correct itself
Medical tasks are diverseThe same framework supports VQA, detection, understanding, and reasoning-based segmentation

🔥 Key Highlights

  • ICML 2026 accepted medical AI framework for tool-augmented visual reasoning.
  • Three-tool agentic toolbox with SAM2, BiomedParse, and zoom-in operations.
  • 64K Tool-Integrated VQA trajectories with explicit tool use and visual grounding.
  • Three-stage training recipe:
    1. Cold-start supervised fine-tuning.
    2. Self-reflection fine-tuning.
    3. Agentic Tool Reinforcement Learning, ATRL.
  • Strong zero-shot generalization across medical VQA benchmarks.
  • Joint medical segmentation, understanding, and reasoning within one agentic framework.
  • Training-free tool transfer by replacing the segmentation tool while preserving the learned tool-use policy.

🧩 Framework Overview

Ophiuchus method

Ophiuchus is trained to produce interleaved multimodal reasoning traces:

Token or actionRole
<think>Textual reasoning and uncertainty assessment
<tool_call> or ActionInvoke image tools for segmentation or zoom-in
<obs>Inject tool outputs, masks, crops, or overlays into the context
Final answerProduce an answer grounded in accumulated visual evidence

The model is not only optimized for answer accuracy. It is also encouraged to use tools when evidence is missing, avoid unnecessary calls when the answer is clear, and correct itself when tool observations contradict earlier reasoning.


🧰 Toolbox

Ophiuchus uses three complementary tools.

ToolInputOutputBest used for
SAM2Bounding boxes proposed by the MLLMSegmentation masksFast region grounding when object location is roughly known
BiomedParseText promptsText-driven segmentation masksRobust localization when bounding boxes are uncertain
Zoom-InBounding boxes or masksCropped regions and optional contour overlaysFine-grained inspection of lesion morphology and boundaries

In practice, Ophiuchus learns to mix these tools according to case difficulty and the type of missing evidence.


🩺 Case Showcase

Below are representative qualitative cases. More details, captions, and examples are provided in the paper.

Visual cue search case

Pattern: the model recognizes that the global view is insufficient, calls segmentation to locate candidate regions, then zooms in to verify subtle visual cues before answering.

2. Confirmation via Zoom-In

Confirmation case

Pattern: after forming a tentative hypothesis, the model performs targeted zoom-ins to confirm key visual signatures and reduce uncertainty.

3. Hallucination Mitigation

Hallucination mitigation case

Pattern: the model detects a mismatch between textual reasoning and visual evidence, invokes tools again, and revises the answer with better grounding.


🏁 Results

Performance comparison on medical VQA benchmarks. Gray-shaded rows denote large-sized models. Bold and underlined indicate the best and second-best results. Improvement denotes the absolute gain of Ophiuchus over Qwen2.5-VL-7B without tool use. Avg. is the arithmetic mean over seven out-of-domain zero-shot benchmarks. Since Med-R1-2B is trained on part of the OmniMedVQA test set, its Avg. is computed over the remaining six benchmarks.

Ophiuchus benchmark results

🧪 Data Preparation

This repository provides training scripts and a minimal data format example.

SFT data: tool-integrated trajectories

A minimal example is provided here:

./data/example/data_case/biomedparser-SFT.json

RL data: one-case schema example

RL data is a list of records. A simplified case schema is shown below.

{
  "question_id": 1,
  "question_type": "multiple choice | segmentation | open-ended | yes/no",
  "question": "string (the prompt/question)",
  "answer": "string (GT label or text answer)",
  "options": ["string list (only for MCQ / constrained answers)"],
  "data_type": "vqa | seg",
  "image_path": ["string list (one or multiple images)"],
  "source": "string (e.g., BioMedParse)",
  "mask_path": ["string list (only for seg tasks, optional)"],
  "max_steps": 6
}

🏋️ Training

Installation for verl

# Please install verl from our repository.
# This helps visualize reward-component trends during training.
conda create -n verl-agent python==3.12 -y
conda activate verl-agent

pip3 install torch==2.6.0 --index-url https://download.pytorch.org/whl/cu124
pip3 install flash-attn==2.7.4.post1 --no-build-isolation

pip3 install -e .
pip3 install vllm==0.8.5

Install Toolbox Environments

Important: To run an agent with external tools, install and configure the corresponding tool environment first. We recommend installing each tool in a separate conda environment to avoid package conflicts.

1. SAM2 environment

SAM2 requires python>=3.10, torch>=2.5.1, and torchvision>=0.20.1. Please follow the official PyTorch instructions to install PyTorch and TorchVision.

cd ./examples/env_server/sam2/sam2
pip install -e .

Download model checkpoints:

cd ./examples/env_server/sam2/checkpoints && \
./download_ckpts.sh && \
cd ..

Individual checkpoints:

2. BiomedParse environment

Create a dedicated environment:

cd ./examples/env_server/BiomedParse/BiomedParse-main
conda create -n biomedparse python=3.9.19
conda activate biomedparse

Install PyTorch:

conda install pytorch torchvision torchaudio pytorch-cuda=12.4 -c pytorch -c nvidia

Install dependencies:

pip install -r assets/requirements/requirements.txt

Please download the Hugging Face model openai/clip-vit-base-patch32 into /openai/clip-vit-base-patch32, and download microsoft/BiomedNLP-BiomedBERT-base-uncased-abstract-fulltext into BiomedParse-main/microsoft/BiomedNLP-BiomedBERT-base-uncased-abstract-fulltext.

Start training

First, run cold-start SFT and self-reflection fine-tuning. Please specify configurations in:

/scripts/SFT/cold-start/my_qwen2_5vl_lora_sft.yaml
/scripts/SFT/reflective_rejection_fine_tuning/config_reflective.yaml

Update the dataset and model_name_or_path fields before training.

Stage A: Cold-start SFT

bash ./scripts/SFT/cold-start/train_cold_start.sh

Stage B: Self-reflection fine-tuning

bash ./scripts/SFT/reflective_rejection_fine_tuning/train_reflective.sh

Stage C: Agentic Tool RL, ATRL

Start the external toolbox first as local API services.

Start the SAM2 server:

bash ./examples/env_server/start_sam2_server.sh

Start the BiomedParse server:

bash ./examples/env_server/start_biomedparse_server.sh

Run GRPO training:

# Customize training parameters according to available hardware to avoid OOM.
bash ./examples/grpo_trainer/run_ATRL.sh

🤔 Model

ModelBase modelCheckpointGPU memory
OphiuchusQwen2.5-VL-7BComing soon17GB

🧑‍⚖️ Evaluation

Detailed evaluation instructions will be updated with the full release. The current release focuses on training scripts, tool environments, and the minimal data schema.


🐎 TODO

  • Announce ICML 2026 acceptance.
  • Add arXiv, PDF, GitHub, and Hugging Face paper links.
  • Release model checkpoints on Hugging Face.
  • Release the dataset on Hugging Face.
  • Add complete evaluation scripts and reproduction commands.
  • Add more qualitative examples and captions.
  • Update citation statistics after indexing.

🙏 Acknowledgement

We gratefully acknowledge the inspiring work of VERL, verl-agent, SAM2, and BioMedParse. These projects provided essential foundations and inspiration for Ophiuchus. We also thank the open-source community for building the tools that make reproducible medical AI research possible.


📈 Citation

If Ophiuchus helps your research, please cite our paper and star the repository. Citation statistics will be updated after indexing by major academic search engines.

Star History Chart
@misc{jiang2025incentivizing,
  title         = {Incentivizing Tool-augmented Thinking with Images for Medical Image Analysis},
  author        = {Yankai Jiang and Yujie Zhang and Peng Zhang and Yichen Li and Jintai Chen and Xiaoming Shi and Shihui Zhen},
  year          = {2025},
  eprint        = {2512.14157},
  archivePrefix = {arXiv},
  primaryClass  = {cs.AI},
  doi           = {10.48550/arXiv.2512.14157}
}

Project health

Overall

4.0/10

Maintained

0/10

Code review

0/10

Contributors

3/10
OpenSSF Scorecard