Skip to content

This contains all the code for AutoOpt Framework.

License

Notifications You must be signed in to change notification settings

abhiskl/AutoOpt

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AutoOpt: Unified Framework for Automated Optimization Understanding (NeurIPS 2025)

Paper Colab Dataset Python License

AutoOpt is an end-to-end automated optimization framework that takes the image of a mathematical program (optimization problem) and solves it without human intervention.

Currently available modules:

  • M1 · Image → LaTeX (MER) — Hybrid CNN‑Transformer model for converting image of a mathematical program into LaTeX script.
  • M2 · LaTeX → Pyomo — Fine‑tuned code generation model for translating LaTeX script to PYOMO (modelling language) code.

M3 · Solver — Understands the PYOMO code and solves the mathematical program using a bilevel decomposition approach (To be released soon)


🧩 Overview

The AutoOpt framework unifies perception, translation, and solving of optimization models through three sequential modules:

  • M1 (Image→LaTeX): Recognizes handwritten/printed optimization models using a hybrid ResNet + Swin Transformer encoder and mBART decoder.
  • M2 (LaTeX→Pyomo): Converts the LaTeX into clean Pyomo scripts using a fine‑tuned LLM.
  • M3 (Solver): Integrates a Bilevel Optimization‑Based Decomposition (BOBD) solver (coming soon).

Dataset: AutoOpt‑11k on Kaggle Paper: AutoOpt: A Dataset and a Unified Framework for Automating Optimization Problem Solving


⚙️ Installation

git clone https://github.com/Shobhit1201/AutoOpt.git
cd AutoOpt/Module_M1
pip install -U pip wheel setuptools
pip install -r requirements.txt

Make sure your PyTorch version matches your CUDA environment. Refer to the PyTorch installation guide.


📊 Evaluation

BLEU Score (higher is better)

BLEU Scores

Character Error Rate (lower is better)

Model (Size) HW PR HW+PR
GPT 4o (Large) 0.1465 0.0664 0.1017
Gemini 2.0 Flash (Large) 0.1607 0.1047 0.1338
Nougat (348.7M) 0.0752 0.0168 0.0440
AutoOpt-M1 (393.3M) 0.0412 0.0176 0.0286

HW: Handwritten; PR: Printed; HW+PR: Handwritten+Printed.


🚀 Usage

🧠 Predict (Image → LaTeX)

!gdown --fuzzy "https://drive.google.com/file/d/1WqfAv0b4FwR8-xqyDLXHTFxBMCas2Fej/view?usp=drive_link" -O checkpoints/m1_weights.pt
python tools/m1_infer.py --image path/to/image.png --checkpoint checkpoints/weights.pth

🧩 Fine‑tune (Custom Dataset)

Prepare your dataset similar to AutoOpt‑11k and execute:

python tools/train_experiment.py --config_file config/base.yaml --phase train

☁️ Colab (Interactive Demo)

Use the hosted Colab notebook to perform inference or fine‑tuning directly: Colab


📁 Directory Structure

AutoOpt/
├── Module M1/
│   ├── nougat‑latex‑ocr/           # MER model code and training utilities
│   ├── Module_M1_Inference.ipynb   # Colab‑ready notebook for inference & finetuning
│
├── Other MER models/
│   ├── Original_Nougat/
│   ├── ChatgptComparison.ipynb
│   └── GeminiComparison.ipynb
│
├── Module_M2.ipynb                 # LaTeX → Pyomo translation notebook
└── README.md

The Colab notebook Module_M1_Inference.ipynb allows users to perform end‑to‑end inference or fine‑tuning without setup.


📚 Dataset — AutoOpt‑11k

Access: Kaggle Dataset

  • 11,554 images (handwritten + printed) labeled with verified LaTeX.
  • 1,018 paired Pyomo scripts for direct LaTeX→code training. The dataset spans linear, nonlinear, convex, nonconvex, and stochastic optimization problems across domains. See AutoOpt_Paper.pdf for detailed composition and statistics.

🧾 Citation

@inproceedings{Sinha2025AutoOpt,
  title     = {AutoOpt: A Dataset and a Unified Framework for Automating Optimization Problem Solving},
  author    = {Ankur Sinha and Shobhit Arora and Dhaval Pujara},
  booktitle = {Proceedings of the 39th Annual Conference on Neural Information Processing Systems (NeurIPS 2025)},
  year      = {2025},
  note      = {arXiv preprint arXiv:2510.21436},
  url       = {https://arxiv.org/abs/2510.21436}
}

🪪 License

Released under the MIT License.


If you find this repository useful, please consider leaving a star on GitHub!

About

This contains all the code for AutoOpt Framework.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 83.5%
  • Jupyter Notebook 16.5%