Views
No views yet

[!NOTE] 🚀 LightOnOCR-2 is now available and state-of-the-art on OlmOCR-bench, with new image detection variants! Check it out here: lightonai/LightOnOCR-2-1B
| Model | ArXiv | Old Scans | Math | Tables | Multi-Column | Tiny Text | Base | Overall |
|---|---|---|---|---|---|---|---|---|
| LightOnOCR-1B-1025 (151k vocab) | 81.4 | 71.6 | 76.4 | 35.2 | 80.0 | 88.7 | 99.5 | 76.1 |
| LightOnOCR-1B-32k (32k vocab) | 80.6 | 66.2 | 73.5 | 33.5 | 71.2 | 87.6 | 99.5 | 73.1 |
| LightOnOCR-1B-16k (16k vocab) | 82.3 | 72.9 | 75.3 | 33.5 | 78.6 | 85.1 | 99.8 | 75.4 |
1
2uv venv --python 3.12 --seed
3source .venv/bin/activate
4
5# install any version higher than 0.11.1
6uv pip install vllm==0.11.2
7# extra deps need only to run the example below
8uv pip install pypdfium2 pillow requests1vllm serve lightonai/LightOnOCR-0.9B-16k-1025 \
2 --limit-mm-per-prompt '{"image": 1}'1import base64
2import requests
3import pypdfium2 as pdfium
4import io
5
6ENDPOINT = "http://localhost:8000/v1/chat/completions"
7MODEL = "lightonai/LightOnOCR-0.9B-16k-1025"
8
9# Download PDF from arXiv
10pdf_url = "https://arxiv.org/pdf/2412.13663"
11pdf_data = requests.get(pdf_url).content
12
13# Open PDF and convert first page to image
14pdf = pdfium.PdfDocument(pdf_data)
15page = pdf[0]
16# Render at 200 DPI (scale factor = 200/72 ≈ 2.77)
17pil_image = page.render(scale=2.77).to_pil()
18
19# Convert to base64
20buffer = io.BytesIO()
21pil_image.save(buffer, format="PNG")
22image_base64 = base64.b64encode(buffer.getvalue()).decode('utf-8')
23
24# Make request
25payload = {
26 "model": MODEL,
27 "messages": [{
28 "role": "user",
29 "content": [{
30 "type": "image_url",
31 "image_url": {"url": f"data:image/png;base64,{image_base64}"}
32 }]
33 }],
34 "max_tokens": 4096,
35 "temperature": 0.2,
36 "top_p": 0.9,
37}
38
39response = requests.post(ENDPOINT, json=payload)
40text = response.json()['choices'][0]['message']['content']
41print(text)| Variant | Description |
|---|---|
| LightOnOCR-1B-1025 | Full multilingual model (default) |
| LightOnOCR-1B-32k | Fastest pruned-vocabulary version (32k tokens) optimized for European languages |
| LightOnOCR-1B-16k | Most compact variant with smallest vocabulary |
@misc{lightonocr2025,
title = {LightOnOCR-1B: End-to-End and Efficient Domain-Specific Vision-Language Models for OCR},
author = {Said Taghadouini and Baptiste Aubertin and Adrien Cavaillès},
year = {2025},
howpublished = {\url{https://huggingface.co/blog/lightonai/lightonocr}}
}