pix2tex-mfr GGUF β€” Math Formula Recognition

GGUF-format models for on-device math OCR, converted from breezedeus/pix2text-mfr (MIT license).

Recognizes printed mathematical expressions in images and outputs LaTeX.

Architecture

  • Encoder: DeiT (Data-efficient Image Transformer) β€” 12 layers, 6 heads, hidden=384
  • Decoder: TrOCR (Transformer OCR) β€” 6 layers, 8 heads, d_model=256, vocab=1200
  • Input: 384Γ—384 RGB image, patch size 16
  • Output: LaTeX token sequence (BPE, 1200 tokens)
  • Parameters: 29.3M

Available Variants

File Format Size Quality Use case
pix2tex-mfr-f32.gguf FP32 112 MB Reference Development/debugging
pix2tex-mfr-f16.gguf FP16 56 MB ~F32 Desktop, full quality
pix2tex-mfr-q8_0.gguf Q8_0 31 MB β‰₯99.5% Desktop, balanced
pix2tex-mfr-q4_k.gguf Q4_K 17 MB β‰₯98% Mobile, smallest

Usage with CrispEmbed

#include "math_ocr.h"

math_ocr_context *ctx = math_ocr_init("pix2tex-mfr-q8_0.gguf", 4);
int len;
const char *latex = math_ocr_recognize(ctx, grayscale_pixels, width, height, &len);
printf("LaTeX: %s\n", latex);  // e.g. "\frac{x^{2}+1}{x-1}"
math_ocr_free(ctx);

Usage with CrispCalc

CrispCalc (Flutter CAS calculator) integrates this model via its OCR feature:

  1. Tap the πŸ“· button on the Calculator or Notepad screen
  2. Take a photo or select from gallery
  3. The model runs on-device via CrispEmbed FFI
  4. Review the recognized expression and insert

Conversion

Converted from ONNX using:

python models/convert-pix2tex-to-gguf.py \
    --model-dir /path/to/pix2text-mfr \
    --output pix2tex-mfr-f16.gguf --fp16

Quantized using:

crispembed-quantize pix2tex-mfr-f16.gguf pix2tex-mfr-q8_0.gguf q8_0
crispembed-quantize pix2tex-mfr-f16.gguf pix2tex-mfr-q4_k.gguf q4_k

Accuracy

Verified against the ONNX reference model:

  • Encoder output: cosine similarity 0.999983 (F32)
  • Decoder logits: match to 3 decimal places
  • End-to-end: produces identical LaTeX tokens for test images

License

  • Model weights: MIT (from breezedeus/pix2text-mfr)
  • GGUF converter: AGPL-3.0 (CrispEmbed)
  • CrispCalc integration: AGPL-3.0

Part of the Crisp ecosystem

Project Role
CrispCalc Flutter CAS calculator with OCR
CrispEmbed ggml inference engine (text + vision + math OCR)
CrispASR Speech recognition engine

Provenance and EU AI Act Art. 53 note

  • Upstream model: breezedeus/pix2text-mfr β€” published by breezedeus.
  • Upstream licence: mit. This repository redistributes under the same terms; it grants no rights the upstream licence does not.
  • What was done here: format conversion and/or quantisation only (GGUF). No training, no fine-tuning, no merging, no distillation, no change to architecture, vocabulary or capability. Only the numeric representation of the upstream weights differs.
  • Training data: documented β€” where it is documented at all β€” by the upstream provider; see the upstream model card. No training data was used, added or selected by this repository.
  • Provider status: under Regulation (EU) 2024/1689 the upstream authors remain the provider of this model. Converting the serialisation format does not make this repository the provider of a new general-purpose AI model, and no such claim is made. Questions about training content, copyright policy or model capability belong upstream.
Downloads last month
566
GGUF
Model size
29.3M params
Architecture
pix2tex_mfr
Hardware compatibility
Log In to add your hardware

8-bit

16-bit

32-bit

Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Model tree for cstr/pix2tex-mfr-gguf

Quantized
(1)
this model