Qwen2.5-VL-7B-CSPO

Official model weights for CSPO: Alleviating Reward Ambiguity for Structured Table-to-LaTeX Generation.

Model Description

Qwen2.5-VL-7B-CSPO is a multimodal model for structured table-to-LaTeX generation. It is built on top of Qwen/Qwen2.5-VL-7B-Instruct and trained to convert table images into complete, compilable LaTeX code.

The model is trained with a two-stage pipeline consisting of supervised fine-tuning (SFT) followed by reinforcement learning with Component-Specific Policy Optimization (CSPO). CSPO introduces component-specific rewards and token-level credit assignment to mitigate reward ambiguity in structured generation, enabling more reliable optimization of table structure, content, and style.

For more details, please see the full model card in the GitHub repository: https://github.com/microsoft/CSPO/blob/main/CSPO_Model_Card.md

Component Detail
Model Qwen2.5-VL-7B-CSPO
Backbone Qwen2.5-VL-7B-Instruct
Model Type Vision-language model
Task Table image-to-LaTeX generation
Input Table image + text instruction
Output LaTeX code
Training Data TableTex
Training Pipeline SFT + CSPO

Training Data

The model is trained on TableTex, a dataset of paired table images and renderable LaTeX code constructed from publicly available arXiv papers under permissive licenses. The dataset contains tables from multiple academic domains, including Computer Science, Mathematics, Economics, Electrical Engineering and Systems Science, Quantitative Finance, and Statistics.

TableTex contains 19,000 table image-LaTeX pairs, split into 15,000 training samples and 4,000 test samples. Each sample includes a rendered table image and corresponding LaTeX code with necessary package declarations, table captions, and the table body.

Evaluation

Detailed evaluation results are reported in our paper.

Usage

import torch
from transformers import AutoProcessor, Qwen2_5_VLForConditionalGeneration
from qwen_vl_utils import process_vision_info

model_id = "yunfanyang1/Qwen2.5-VL-7B-CSPO"

model = Qwen2_5_VLForConditionalGeneration.from_pretrained(
    model_id,
    torch_dtype=torch.bfloat16,
    device_map="auto",
    attn_implementation="flash_attention_2",
)

processor = AutoProcessor.from_pretrained(model_id)

messages = [
    {
        "role": "user",
        "content": [
            {"type": "image", "image": "file:///absolute/path/to/table_image.png"},
            {
                "type": "text",
                "text": "Please generate complete LaTeX code for the table in the image, including the table body and the full preamble."
            },
        ],
    }
]

text = processor.apply_chat_template(
    messages,
    tokenize=False,
    add_generation_prompt=True,
)

image_inputs, video_inputs = process_vision_info(messages)

inputs = processor(
    text=[text],
    images=image_inputs,
    videos=video_inputs,
    padding=True,
    padding_side="left",
    return_tensors="pt",
).to(model.device)

generated_ids = model.generate(
    **inputs,
    max_new_tokens=8192,
    do_sample=False,
)

generated_ids_trimmed = [
    out_ids[len(in_ids):]
    for in_ids, out_ids in zip(inputs.input_ids, generated_ids)
]

output_text = processor.batch_decode(
    generated_ids_trimmed,
    skip_special_tokens=True,
    clean_up_tokenization_spaces=False,
)

print(output_text[0])

See the GitHub repository for full installation, evaluation, and training instructions.

License

This model is built on top of Qwen/Qwen2.5-VL-7B-Instruct; users should also comply with the license and terms of the base model.

Citation

If you find this model useful, please cite our paper:

@article{yang2026cspo,
  title={CSPO: Alleviating Reward Ambiguity for Structured Table-to-LaTeX Generation},
  author={Yang, Yunfan and Lan, Cuiling and Sang, Jitao and Lu, Yan},
  journal={arXiv preprint arXiv:2604.10918},
  year={2026}
}
Downloads last month
5
Safetensors
Model size
8B params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for yunfanyang1/Qwen2.5-VL-7B-CSPO

Finetuned
(1175)
this model

Dataset used to train yunfanyang1/Qwen2.5-VL-7B-CSPO

Paper for yunfanyang1/Qwen2.5-VL-7B-CSPO