Mirage

UMass-Embodied-AGI长期未更新

让视觉语言模型在推理时生成隐式视觉 token 做「脑内想象」,无需输出真实图像就能增强多模态空间推理能力。

[CVPR 2026] Machine Mental Imagery: Empower Multimodal Reasoning with Latent Visual Tokens

暂无版本303star17fork同步于 2026-11-07 07:31 UTC

怎么上手

由 README 提炼,执行前请确认
conda create -n mirage python=3.10
conda activate mirage
git clone https://github.com/UMass-Embodied-AGI/Mirage.git
cd Mirage
pip install -r requirements.txt
pip install -e ./transformers/.
硬件要求按 README 说明

README 未说明显存要求;训练与推理均以 Qwen2.5-VL-7B-Instruct 为基座,需能承载 7B 模型的环境,未提及 CPU 运行或具体 GPU 型号

下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

用潜在视觉 token 代替像素级图像生成,提升多模态推理性能的研究代码

让视觉语言模型在推理时生成隐式视觉 token 做「脑内想象」,无需输出真实图像就能增强多模态空间推理能力。

核心能力

  • 将紧凑的潜在视觉 token 与文本 token 交错拼接
  • 两阶段训练:先联合监督文本与潜在视觉 token,再撤除潜在监督
  • 提供 VSP 空间规划任务的训练与测试代码及模型权重
  • 基于 Qwen2.5-VL-7B-Instruct 微调,支持自定义 latent_size

容易踩的坑

需额外执行 pip install -e ./transformers/. 安装定制版 transformers,仅装 requirements.txt 不够;基座模型 Qwen2.5-VL 会自动下载到 ./cache,需预留空间或用 cache_dir 改路径;数据集需先解压 tar.gz 才能训练,推理权重从 HuggingFace 拉取

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

0 个版本

暂无 release 数据(可能没有发版,或尚未同步)。

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    We propose Mirage, interleaving latent visual tokens, which represent compact imagery visual features, with explicit text tokens to solve diverse multimodal reasoning tasks, boosting the reasoning performance without the full pixel-level image generation.

    News

    • [2025-07-23] We have released our test code, data, and model weights for VSP spatial planning task.
    • [2025-07-09] We have released our training data for VSP spatial planning task.
    • [2025-06-19] We have released the training code!

    Installation

    Create a conda environment and install the required packages:

    conda create -n mirage python=3.10
    conda activate mirage
    
    git clone https://github.com/UMass-Embodied-AGI/Mirage.git
    cd Mirage
    pip install -r requirements.txt
    pip install -e ./transformers/.
    

    Data Preparation

    We provide a sample dataset of 100 examples for the VSP spatial reasoning task. Please format your data file as follows:

    {
        "text_input": "Question",
        "text_output": "Answer",
        "image_input": "input1.jpg",
        "image_output": "helper_image.jpg"
    }
    

    We also provide the training and test data for VSP spatial planning task. To extract the contents:

    cd ./data/vsp_spatial_planning
    tar -xzf vsp_spatial_planning.tar.gz
    tar -xzf vsp_spatial_planning_test.tar.gz
    

    Training

    We train our model in two stages:

    • Stage 1 jointly supervises text and latent visual tokens, grounding the latter in the visual subspace.
    • Stage 2 drops the latent supervision, anchoring the grounded latent tokens for subsequent text generation.

    Run the following commands to reproduce the training. Make sure to configure the data_path and model_path as needed. The base model (Qwen2.5-VL) will be automatically downloaded in ./cache, specify cache_dir if you want to change huggingface download folder.

    Training Stage 1

    python src/main.py \
        --model Qwen/Qwen2.5-VL-7B-Instruct --epochs 15 \
        --task vsp-spatial-planning \
        --latent_size 4 \
        --gradient_accumulation_steps 8 \
        --stage stage1 \
        --data_path ./data/vsp_spatial_planning/train_direct.jsonl \
        --log_file ./log.txt \
        --save_model_path ./checkpoints/model_stage1  \
        --cache_dir PATH_TO_HF_CACHE
    

    Training Stage 2

    python src/main.py \
        --model Qwen/Qwen2.5-VL-7B-Instruct --epochs 15 \
        --task vsp-spatial-planning \
        --latent_size 4 \
        --gradient_accumulation_steps 1 \
        --stage stage2 \
        --data_path ./data/vsp_spatial_planning/train_direct.jsonl \
        --log_file ./log.txt \
        --load_model_path ./checkpoints/model_stage1 \
        --save_model_path ./checkpoints/model_stage2 \
        --cache_dir PATH_TO_HF_CACHE
    

    Inference

    You can run the test code using the command below. Currently, we provide model checkpoints for the VSP spatial planning task training without CoT. We will continue updating the model weights and scaling the dataset to further improve performance.

    python src/test.py \
        --model Qwen/Qwen2.5-VL-7B-Instruct --epochs 15 \
        --task vsp-spatial-planning \
        --data_path ./data/vsp_spatial_planning/test_direct.jsonl \
        --load_model_path Miiche/vsp_spatial_planning_direct_sft  \
        --cache_dir PATH_TO_HF_CACHE
    

    Citation

    If you find our work useful, please consider citing:

    @article{yang2025machine,
      title={Machine Mental Imagery: Empower Multimodal Reasoning with Latent Visual Tokens}, 
      author={Zeyuan Yang and Xueyang Yu and Delin Chen and Maohao Shen and Chuang Gan},
      year={2025},
      eprint={2506.17218},
      archivePrefix={arXiv},
      primaryClass={cs.CV},
      url={https://arxiv.org/abs/2506.17218}, 
    }
    

    Acknowledgement

    We would like to thank the following works for their code and models:

    We are extremely grateful to Haoyu Zhen, Bairu Hou, Guangtao Zeng, Yuncong Yang, Jiaben Chen, Ziwei Liu, Zonghan Yang, Sunli Chen, Lixing Fang, and many other friends in our Embodied AGI Lab for their helpful feedback and insightful discussions.