Model reference · open weights
LightOnOCR-2-bbox is an open-weight language model from lightonai. AxForge deploys and operates it for you on dedicated EU-owned hardware — with the licence handled where one is required.
Available as managed deployment — configured and operated for you on dedicated EU hardware, quoted per deployment.
What it is
| Maker | lightonai |
|---|---|
| Type | Language models |
| Task | Vision + text |
| Parameters (lead) | 1.0B |
| Runs with | transformers |
| Released | 2026-01-16 |
| Popularity | 9k downloads / month |
| Licence | Open weights |
About
Best model with image localization. This model predicts both text and precise bounding boxes for embedded images, refined with RLVR using IoU-based rewards for maximum localization accuracy.
LightOnOCR-2 is an efficient end-to-end 1B-parameter vision-language model for converting documents (PDFs, scans, images) into clean, naturally ordered text without relying on brittle pipelines. This second version is trained on a larger and higher-quality corpus with stronger French, arXiv, and scan coverage, improved LaTeX handling, and cleaner normalization. LightOnOCR-2 achieves state-of-the-art performance on OlmOCR-Bench while being ~9× smaller and significantly faster than competing approaches.
| Variant | Description |
|---|---|
| LightOnOCR-2-1B | Best OCR model |
| LightOnOCR-2-1B-base | Base model, ideal for fine-tuning |
| LightOnOCR-2-1B-bbox | Best model with image bounding boxes |
| LightOnOCR-2-1B-bbox-base | Base bbox model, ideal for fine-tuning |
| LightOnOCR-2-1B-ocr-soup | Merged variant for extra robustness |
| LightOnOCR-2-1B-bbox-soup | Merged variant: OCR + bbox combined |
The output format for embedded images is:
Where coordinates are normalized to [0, 1000].
See the paper for full benchmark details and methodology.
Note: LightOnOCR-2 requires transformers installed from source (not yet in a stable release).
uv pip install git+https://github.com/huggingface/transformers
uv pip install pillow pypdfium2
import torch
from transformers import LightOnOcrForConditionalGeneration, LightOnOcrProcessor
device = "mps" if torch.backends.mps.is_available() else "cuda" if torch.cuda.is_available() else "cpu"
dtype = torch.float32 if device == "mps" else torch.bfloat16
model = LightOnOcrForConditionalGeneration.from_pretrained("lightonai/LightOnOCR-2-1B-bbox", torch_dtype=dtype).to(device)
processor = LightOnOcrProcessor.from_pretrained("lightonai/LightOnOCR-2-1B-bbox")
url = "https://huggingface.co/datasets/hf-internal-testing/fixtures_ocr/resolve/main/SROIE-receipt.jpeg"
conversation = [{"role": "user", "content": [{"type": "image", "url": url}]}]
inputs = processor.apply_chat_template(
conversation,
add_generation_prompt=True,
tokenize=True,
return_dict=True,
return_tensors="pt",
)
inputs = {k: v.to(device=device, dtype=dtype) if v.is_floating_point() else v.to(device) for k, v in inputs.items()}
output_ids = model.generate(**inputs, max_new_tokens=1024)
generated_ids = output_ids[0, inputs["input_ids"].shape[1]:]
output_text = processor.decode(generated_ids, skip_special_tokens=True)
print(output_text)
# Output will include bounding boxes like this(no space): 120,50,850,400
vllm serve lightonai/LightOnOCR-2-1B-bbox \
--limit-mm-per-prompt '{"image": 1}' --mm-processor-cache-gb 0 --no-enable-prefix-caching
import base64
import requests
import pypdfium2 as pdfium
import io
ENDPOINT = "http://localhost:8000/v1/chat/completions"
MODEL = "lightonai/LightOnOCR-2-1B-bbox"
# Download PDF from arXiv
pdf_url = "https://arxiv.org/pdf/2412.13663"
pdf_data = requests.get(pdf_url).content
# Open PDF and convert first page to image
pdf = pdfium.PdfDocument(pdf_data)
page = pdf[0]
# Render at 200 DPI (scale factor = 200/72 ≈ 2.77)
pil_image = page.render(scale=2.77).to_pil()
# Convert to base64
buffer = io.BytesIO()
pil_image.save(buffer, format="PNG")
image_base64 = base64.b64encode(buffer.getvalue()).decode('utf-8')
# Make request
payload = {
"model": MODEL,
"messages": [{
"role": "user",
"content": [{
"type": "image_url",
"image_url": {"url": f"data:image/png;base64,{image_base64}"}
}]
}],
"max_tokens": 4096,
"temperature": 0.2,
"top_p": 0.9,
}
response = requests.post(ENDPOINT, json=payload)
text = response.json()['choices'][0]['message']['content']
print(text)
LightOnOCR-2-1B-bbox is fully differentiable and supports:
For fine-tuning, consider starting
From the published model card. Full card on the HuggingFace links in the sidebar.
Using it via the API
Once AxForge deploys lightonocr-2-bbox for you, it answers on the OpenAI-compatible API — the same base URL and keys as every other model. (lightonocr-2-bbox below is illustrative; you get the exact model name on deployment.)
$ curl -sS https://api.axforge.ai/v1/chat/completions \
-H "Authorization: Bearer $AXFORGE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"lightonocr-2-bbox","messages":[{"role":"user","content":"Hello"}]}'
Create an account — your API key is available in the console. 5M tokens/month currently included with every new account at launch.