Recognition Engine

August 31, 2026 ยท View on GitHub

Model Choice: CoMER (via ink-on)

The recognition engine uses CoMER (Coverage Maximization ExtRactor), a Transformer-based model trained on the CROHME handwritten math expression dataset. The model is packaged as INT8-quantized ONNX (7.2 MB total: 3.4 MB encoder + 4.0 MB decoder).

Why CoMER over pix2tex

CriterionCoMER (ink-on)pix2tex
Training dataCROHME (handwritten)Printed formulas
Model size7.2 MB (INT8)~50 MB
LicenseApache-2.0AGPL-3.0
Browser inferenceONNX Runtime WebPyTorch (impractical)

CoMER is handwritten-first, matching the primary use case. pix2tex is trained on printed formulas and would underperform on handwriting.

ink-on Library

ink-on v0.1.0 is a framework-agnostic, browser-only math recognition library:

  • License: Apache-2.0
  • Core: framework-agnostic (works with React, Svelte, vanilla JS)
  • Built-in repair: brace balancing, arity completion, KaTeX validation
  • IndexedDB cache: models cached locally after first download

Pinned Assets

FileURLSize
encoder_int8.onnxhttps://github.com/kimseungdae/ink-on/releases/download/v0.1.0/encoder_int8.onnx3.4 MB
decoder_int8.onnxhttps://github.com/kimseungdae/ink-on/releases/download/v0.1.0/decoder_int8.onnx4.0 MB
vocab.jsonhttps://github.com/kimseungdae/ink-on/releases/download/v0.1.0/vocab.json4 KB

Printed-Formula Fallback

Printed formula screenshots (OCR path) may underperform with CoMER. A future pix2tex fallback can be wired behind the same MathRecognizer interface โ€” the engine facade in src/recognition/engine.ts isolates UI code from the backend choice.

AGPL Exclusion

lia-canvas-ocr was excluded due to AGPL-3.0 licensing incompatibility. The ink-on + CoMER path provides full browser-side recognition under permissive licenses.