MathFlow: Enhancing the Perceptual Flow of MLLMs for Visual Mathematical Problems

July 1, 2026 ยท View on GitHub

MathQA Mathematical Reasoning Multi-Modal

GPT-4V Gemini Claude Qwen2VL InternVL DeepSeekV3 DeepSeekR1

๐Ÿ’ฅ News

๐Ÿ‘€ About MathFlow

Despite impressive performance across diverse tasks, Multimodal Large Language Models (MLLMs) have yet to fully demonstrate their potential in visual mathematical problem-solving, particularly in accurately perceiving and interpreting diagrams.


The Overview of MathFlow Pipeline.

Inspired by typical processes of humans, we hypothesize that the perception capabilities to extract meaningful information from diagrams is crucial, as it directly impacts subsequent inference processes. To validate this hypothesis, we developed FlowVerse, a comprehensive benchmark that categorizes all information used during problem-solving into four components, which are then combined into six problem versions for evaluation.


Six Versions of Problems in FlowVerse.

Our preliminary results on FlowVerse reveal that existing MLLMs exhibit substantial limitations when extracting essential information and reasoned property from diagrams and performing complex reasoning based on these visual inputs. In response, we introduce MathFlow, a modular problem-solving pipeline that decouples perception and inference into distinct stages, thereby optimizing each independently. Given the perceptual limitations observed in current MLLMs, we trained MathFlow-P-7B as a dedicated perception model. Experimental results indicate that MathFlow-P-7B yields substantial performance gains when integrated with various closed-source and open-source inference models. This demonstrates the effectiveness of the MathFlow pipeline and its compatibility to diverse inference frameworks. The FlowVerse benchmark, code and models will be made publicly available upon publication.

๐Ÿ’ช Evaluation by yourself

We provide the code to derive the 'Acc' scores and 'CoT-E' scores by yourself, which requires advanced LLMs (e.g., ChatGPT/GPT-4, or Qwen-Max) to extract and match answers.

There are two steps for the evaluation of 'Acc' scores and 'CoT-E' scores, where we prompt the ChatGPT/GPT-4 API as an example to obtain the 'Acc' scores:

Step1: Answer Obtain

pip install openai
cd evaluation_cot 
# Please replace the GPT_API with your own API key in models/gpt.py
python generate_response.py \
--data_dir PATH_TO_DATA_DIR \
--input_file PATH_TO_INPUT_FILE \
--output_dir PATH_TO_OUTPUT_DIR \
--output_file PATH_TO_OUTPUT_FILE \
--mode MODE_OF_FLOWVERSE \
--img_dir PATH_TO_IMG_DIR \

Step2: Answer Extraction

python extract_answer_s1.py \
--model_output_file PATH_TO_OUTPUT_FILE \
--output_file PATH_TO_GENERATED_FILE \
--mode MODE_OF_FLOWVERSE \
--save_file PATH_TO_ENTRACTION_FILE \

Note that, step 1 is optional if your MLLM can directly output a clean answer for scoring.

Step3: Answer Scoring

python score_answer_s2.py \
--save_file PATH_TO_SCORE_FILE \
--mode MODE_OF_FLOWVERSE \
--output_dir PATH_TO_OUTPUT_DIR \
--output_file PATH_TO_SCORE_FILE \
--trunk_response 30 \
--save_every 10 \

Step4: Answer Statistics

python score_final.py \
--data_dir PATH_TO_DATA_DIR \
--input_file PATH_TO_INPUT_FILE \
--save_file PATH_TO_SCORE_FILE \
--mode MODE_OF_FLOWVERSE 

๐Ÿค– Data Usage

FlowVerse dataset is available on Huggingface.

๐Ÿ“ Citation

If you find our data or code useful in your research, please use the following BibTeX entry.

@inproceedings{chen-etal-2026-mathflow,
    title = "MathFlow: Enhancing the Perceptual Flow of MLLMs for Visual Mathematical Problems",
    author = "Chen, Shuhang  and Yuan, Hangjie  and Xu, Yunqiu  and Liu, Pengwei  and Feng, Tao  and Cen, Jun  and Huang, Zeying  and Yang, Yi",
    booktitle = "Proceedings of the 64th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers)",
    year = "2026",
    pages = "967--992",
}

Explore our additional research on Vision-Language Large Models, focusing on multi-modal LLMs and mathematical reasoning: