---
language:
- en
license: apache-2.0
size_categories:
- 1K<n<10K
task_categories:
- question-answering
- visual-question-answering
pretty_name: Image2Structure - Latex
dataset_info:
- config_name: algorithm
  features:
  - name: structure
    dtype: string
  - name: text
    dtype: string
  - name: image
    dtype: image
  - name: download_url
    dtype: string
  - name: instance_name
    dtype: string
  - name: date
    dtype: string
  - name: additional_info
    dtype: string
  - name: date_scrapped
    dtype: string
  - name: file_filters
    dtype: string
  - name: compilation_info
    dtype: string
  - name: rendering_filters
    dtype: string
  - name: assets
    sequence: string
  - name: category
    dtype: string
  - name: uuid
    dtype: string
  - name: length
    dtype: string
  - name: difficulty
    dtype: string
  splits:
  - name: validation
    num_bytes: 35687268.0
    num_examples: 300
  download_size: 33800484
  dataset_size: 35687268.0
- config_name: equation
  features:
  - name: structure
    dtype: string
  - name: text
    dtype: string
  - name: image
    dtype: image
  - name: download_url
    dtype: string
  - name: instance_name
    dtype: string
  - name: date
    dtype: string
  - name: additional_info
    dtype: string
  - name: date_scrapped
    dtype: string
  - name: file_filters
    dtype: string
  - name: compilation_info
    dtype: string
  - name: rendering_filters
    dtype: string
  - name: assets
    sequence: string
  - name: category
    dtype: string
  - name: uuid
    dtype: string
  - name: length
    dtype: string
  - name: difficulty
    dtype: string
  splits:
  - name: validation
    num_bytes: 6048536.0
    num_examples: 300
  download_size: 4696512
  dataset_size: 6048536.0
- config_name: plot
  features:
  - name: structure
    dtype: string
  - name: text
    dtype: string
  - name: image
    dtype: image
  - name: download_url
    dtype: string
  - name: instance_name
    dtype: string
  - name: date
    dtype: string
  - name: additional_info
    dtype: string
  - name: date_scrapped
    dtype: string
  - name: file_filters
    dtype: string
  - name: compilation_info
    dtype: string
  - name: rendering_filters
    dtype: string
  - name: assets
    sequence: string
  - name: category
    dtype: string
  - name: uuid
    dtype: string
  - name: length
    dtype: string
  - name: difficulty
    dtype: string
  splits:
  - name: validation
    num_bytes: 12245318.0
    num_examples: 300
  download_size: 8209981
  dataset_size: 12245318.0
- config_name: table
  features:
  - name: structure
    dtype: string
  - name: text
    dtype: string
  - name: image
    dtype: image
  - name: download_url
    dtype: string
  - name: instance_name
    dtype: string
  - name: date
    dtype: string
  - name: additional_info
    dtype: string
  - name: date_scrapped
    dtype: string
  - name: file_filters
    dtype: string
  - name: compilation_info
    dtype: string
  - name: rendering_filters
    dtype: string
  - name: assets
    sequence: string
  - name: category
    dtype: string
  - name: uuid
    dtype: string
  - name: length
    dtype: string
  - name: difficulty
    dtype: string
  splits:
  - name: validation
    num_bytes: 30860645.0
    num_examples: 300
  download_size: 29140278
  dataset_size: 30860645.0
- config_name: wild
  features:
  - name: image
    dtype: image
  - name: additional_info
    dtype: string
  - name: assets
    sequence: string
  - name: category
    dtype: string
  - name: uuid
    dtype: string
  - name: difficulty
    dtype: string
  splits:
  - name: validation
    num_bytes: 163753.0
    num_examples: 2
  download_size: 157850
  dataset_size: 163753.0
- config_name: wild_legacy
  features:
  - name: image
    dtype: image
  - name: url
    dtype: string
  - name: instance_name
    dtype: string
  - name: date_scrapped
    dtype: string
  - name: uuid
    dtype: string
  - name: category
    dtype: string
  - name: additional_info
    dtype: string
  - name: assets
    sequence: string
  - name: difficulty
    dtype: string
  splits:
  - name: validation
    num_bytes: 497129.0
    num_examples: 50
  download_size: 496777
  dataset_size: 497129.0
configs:
- config_name: algorithm
  data_files:
  - split: validation
    path: algorithm/validation-*
- config_name: equation
  data_files:
  - split: validation
    path: equation/validation-*
- config_name: plot
  data_files:
  - split: validation
    path: plot/validation-*
- config_name: table
  data_files:
  - split: validation
    path: table/validation-*
- config_name: wild
  data_files:
  - split: validation
    path: wild/validation-*
- config_name: wild_legacy
  data_files:
  - split: validation
    path: wild_legacy/validation-*
tags:
- biology
- finance
- economics
- math
- physics
- computer_science
- electronics
- statistics
---

# Image2Struct - Latex
[Paper](TODO) | [Website](https://crfm.stanford.edu/helm/image2structure/latest/) | Datasets ([Webpages](https://huggingface.co/datasets/stanford-crfm/i2s-webpage), [Latex](https://huggingface.co/datasets/stanford-crfm/i2s-latex), [Music sheets](https://huggingface.co/datasets/stanford-crfm/i2s-musicsheet)) | [Leaderboard](https://crfm.stanford.edu/helm/image2structure/latest/#/leaderboard) | [HELM repo](https://github.com/stanford-crfm/helm) | [Image2Struct repo](https://github.com/stanford-crfm/image2structure)

**License:** [Apache License](http://www.apache.org/licenses/) Version 2.0, January 2004
                        

## Dataset description
Image2struct is a benchmark for evaluating vision-language models in practical tasks of extracting structured information from images.
This subdataset focuses on LaTeX code. The model is given an image of the expected output with the prompt:
```Please provide the LaTex code used to generate this image. Only generate the code relevant to what you see. Your code will be surrounded by all the imports necessary as well as the begin and end document delimiters.```

 The subjects were collected on ArXiv and are: eess, cs, stat, math, physics, econ, q-bio, q-fin.
 
 The dataset is divided into 5 categories. There are 4 categories that are collected automatically using the [Image2Struct repo](https://github.com/stanford-crfm/image2structure):
* equations
* tables
* algorithms
* code

The last category: **wild**, was collected by taking screenshots of equations in the Wikipedia page of "equation" and its related pages.

## Uses

To load the subset `equation` of the dataset to be sent to the model under evaluation in Python:

```python
import datasets
datasets.load_dataset("stanford-crfm/i2s-latex", "equation", split="validation")
```


To evaluate a model on Image2Latex (equation) using [HELM](https://github.com/stanford-crfm/helm/), run the following command-line commands:

```sh
pip install crfm-helm
helm-run --run-entries image2latex:subset=equation,model=vlm --models-to-run google/gemini-pro-vision --suite my-suite-i2s --max-eval-instances 10
```

You can also run the evaluation for only a specific `subset` and `difficulty`:
```sh
helm-run --run-entries image2latex:subset=equation,difficulty=hard,model=vlm --models-to-run google/gemini-pro-vision --suite my-suite-i2s --max-eval-instances 10
```

For more information on running Image2Struct using [HELM](https://github.com/stanford-crfm/helm/), refer to the [HELM documentation](https://crfm-helm.readthedocs.io/) and the article on [reproducing leaderboards](https://crfm-helm.readthedocs.io/en/latest/reproducing_leaderboards/).

## Citation

**BibTeX:**

```tex
@misc{roberts2024image2struct,
      title={Image2Struct: A Benchmark for Evaluating Vision-Language Models in Extracting Structured Information from Images}, 
      author={Josselin Somerville Roberts and Tony Lee and Chi Heem Wong and Michihiro Yasunaga and Yifan Mai and Percy Liang},
      year={2024},
      eprint={TBD},
      archivePrefix={arXiv},
      primaryClass={TBD}
}
```