lightonai/LightOnOCR-3-0.8B by LightOn, converted to ONNX for superPDF, where it powers
high-accuracy reading in the browser (WebGPU, superpdf.ai) and the command-line tool (default model). It runs with Transformers.js on ONNX Runtime (WebGPU), in the browser and in Node.
Conversion
- Base weights:
lightonai/LightOnOCR-3-0.8B at revision 36d8636925327c671bd8e479c517a004f7566bd9 (safetensors, bfloat16).
- Graphs:
onnx-community/Qwen3.5-0.8B-ONNX-OPT at revision 969350d5f4647ec9ac277110f8974c65d8c10e4b (LightOnOCR-3 uses the Qwen3.5 architecture; the configurations match apart
from the unused multi-token-prediction layer). Every weight in those graphs is recomputed from LightOn's weights and
written at the same place, so the graphs themselves are unchanged.
- Quantisation: decoder and token embeddings 4-bit (ONNX Runtime
MatMulNBits / GatherBlockQuantized, block size 32,
asymmetric with zero points, computed with ONNX Runtime's own quantize_matmul_4bits); vision encoder float16.
Norm weights are stored as 1 + w and the gated delta net's A as -exp(A_log), as the builder expects.
- Converter: scripts/models/convert-lightonocr.py in the superPDF repository (to be published with the open-source release).
- These are the same bytes as
andrzej/LightOnOCR_webGPU at revision a1cbb49375e34c821d011976f9a441c63e3f3478 (Apache-2.0), mirrored here so superPDF depends only on its own repository. superPDF checked them independently with its own converter (below): the vision encoder is bit-identical, every other tensor is identical except 4-bit rounding ties (under 0.1% of packed bytes), and the float tensors (norms, gates, convolutions) match exactly.
config.json is LightOn's with the transformers.js_config block of the onnx-community repository; tokenizer and
processor files are the onnx-community ones (same Qwen3.5 vocabulary).
Use
Transcription with boxes (LightOn's grounding prompt), greedy decoding, pages rendered with their longest side at
1540 to 2048 pixels:
import { AutoProcessor, Qwen3_5ForConditionalGeneration, RawImage } from '@huggingface/transformers';
const id = 'superpdf/LightOnOCR-3-0.8B-ONNX-web';
const processor = await AutoProcessor.from_pretrained(id);
const model = await Qwen3_5ForConditionalGeneration.from_pretrained(id, { device: 'webgpu', dtype: { embed_tokens: 'q4', decoder_model_merged: 'q4', vision_encoder: 'fp16' } });
const prompt = processor.apply_chat_template([{ role: 'user', content: [{ type: 'image' }, { type: 'text', text: 'grounding' }] }], { add_generation_prompt: true, enable_thinking: false });
const inputs = await processor(prompt, await RawImage.read('page.png'));
const output = await model.generate({ ...inputs, max_new_tokens: 6144, do_sample: false });
Files and SHA-256
| File |
Bytes |
SHA-256 |
chat_template.jinja |
7755 |
273d8e0e683b885071fb17e08d71e5f2a5ddfb5309756181681de4f5a1822d80 |
config.json |
2863 |
d04085ec216c194938fde31382c986bde324ea66984947bd5368d1f6ed5f4110 |
generation_config.json |
205 |
b1cfebea5837fc69aa89c3e2210dbe6494bb29a04e1e88beb227ddad53b9dfc1 |
onnx/decoder_model_merged_q4.onnx |
576621 |
2811aa186271f479eed82e9bd247f1552630a62c1f59fa290fe15da7152c7176 |
onnx/decoder_model_merged_q4.onnx_data |
483655680 |
7f624b47bccb5d000e7014c25dfd2bb4c713810e1b3b8a5736668cc94f1052b8 |
onnx/embed_tokens_q4.onnx |
857 |
8773dcf4858f855bfce13def4356ca17e0bc516a477154496b6ffb6dd6d084dc |
onnx/embed_tokens_q4.onnx_data |
162897920 |
7203c41864967ef4d834898ab48691756eba5e6645e8dd20d341e0b8049c1c27 |
onnx/vision_encoder_fp16.onnx |
187476 |
7343242b844eed7288a7f6ef3f0dc57a7ceb5118c3f50547bb0458de5dfea645 |
onnx/vision_encoder_fp16.onnx_data |
204798464 |
a41cfcee4d164634c04034ecd71e62b3c71d25166f54df29cfa2323548021454 |
preprocessor_config.json |
390 |
27225450ac9c6529872ee1924fcb0962ff5634834f817040f444118116f4e516 |
processor_config.json |
1300 |
14932921ca485d458a04dafd8069fbb0a4505622a48208d19ed247115801385b |
tokenizer.json |
19226111 |
89da80cc6689bef4d90cc1028249436975ffb0814618f1d93c65310e05801a9b |
tokenizer_config.json |
10060 |
c4cd279f8fed1ddea0d23ab13e7ec255b15fcad0200ec0487fb853d880b0b40b |
Also in SHA256SUMS (check with shasum -a 256 -c SHA256SUMS).
Licence
Apache License 2.0, as the original model. See LICENSE and NOTICE. Scores and model details: see LightOn's
model card for lightonai/LightOnOCR-3-0.8B.