LastByteLLC/latextract

Extract LaTeX formula from images using constrained decoding

0

stars

17

commits

Python

primary language

May 3, 2026

updated

lastbytellc.github.io/latextract/
cbnf
latex
sundai

README

latextract

Deterministic, self-verifying formula-to-LaTeX library. Wraps an off-the-shelf math-OCR model with grammar-constrained decoding + render-and-SSIM verification, so every accepted output is guaranteed to re-render to within SSIM ≥ 0.95 of the input — never broken LaTeX.

Quick start

git clone https://github.com/LastByteLLC/latextract.git
cd latextract
uv venv --python 3.11 .venv
source .venv/bin/activate
uv pip install -e .
brew install tectonic                        # macOS; apt on Linux

# extract one formula image
python -m latextract.cli extract path/to/formula.png

# build a small eval set + run the harness
python scripts/build_dataset.py --n-papers 12
python scripts/run_eval.py

See data/eval/summary.md for current results, RUNPOD.md for cloud fine-tuning, MLX.md for Apple-Silicon native conversion.

Contributors

Tombarr

17 commits

LastByteLLC/latextract

Extract LaTeX formula from images using constrained decoding

0

stars

17

commits

Python

primary language

May 3, 2026

updated

lastbytellc.github.io/latextract/
cbnf
latex
sundai

README

latextract

Deterministic, self-verifying formula-to-LaTeX library. Wraps an off-the-shelf math-OCR model with grammar-constrained decoding + render-and-SSIM verification, so every accepted output is guaranteed to re-render to within SSIM ≥ 0.95 of the input — never broken LaTeX.

Quick start

git clone https://github.com/LastByteLLC/latextract.git
cd latextract
uv venv --python 3.11 .venv
source .venv/bin/activate
uv pip install -e .
brew install tectonic                        # macOS; apt on Linux

# extract one formula image
python -m latextract.cli extract path/to/formula.png

# build a small eval set + run the harness
python scripts/build_dataset.py --n-papers 12
python scripts/run_eval.py

See data/eval/summary.md for current results, RUNPOD.md for cloud fine-tuning, MLX.md for Apple-Silicon native conversion.

Contributors

Tombarr

17 commits

Languages

Python

72.4%

TypeScript

19.7%

Shell

4.7%

CSS

1.8%

HTML

1.3%