Skip to content
ModelListedExternal
Browse files

Ppformulanet L GGUF

GGUF-quantized versions of PaddlePaddle's PP-FormulaNet-L for on-device printed formula recognition (image to LaTeX).

KindModelBase modelPaddlePaddle/PP-FormulaNet-L_safetensorsVersionRevision e97569bBgrade

Model source

Kind
Model
File size
121–346 MB
Base model
PaddlePaddle/PP-FormulaNet-L_safetensors
Version
vRevision e97569b
Updated
Oct 30, 2026
Downloads
250
Source
Hugging Face

Source description

PP-FormulaNet-L GGUF — Printed Math OCR

GGUF-quantized versions of PaddlePaddle's PP-FormulaNet-L for on-device printed formula recognition (image to LaTeX).

Model Description

PropertyValue
ArchitectureSAM-ViT encoder + MBart Transformer decoder
Parameters181M
Input768x768 RGB image
OutputLaTeX token sequence
Vocab50,000 tokens (NougatTokenizer / BPE)
LicenseApache-2.0

Encoder: SAM-style Vision Transformer

PropertyValue
TypeSAM ViT-B (from PaddleOCR Vary_VIT_B_Formula)
Layers12
Hidden dim768
Heads12
MLP dim3072
Patch size16x16 (48x48 patches)
AttentionWindowed (ws=14) on layers 0,1,3,4,6,7,9,10; Global on layers 2,5,8,11
Position biasDecomposed relative position (per-axis, interpolated)
NeckConv1x1 + LayerNorm2d + Conv3x3 + LayerNorm2d (768 -> 256)
Projector2x Conv3x3(stride=2) + 2x Linear (256 -> 512). Output: 144 tokens x 512d

Decoder: MBart (Pre-LayerNorm)

PropertyValue
Layers8
Heads16
d_model512
FFN dim2048
ActivationGELU
Embeddingscale_embedding = sqrt(512)
Max length1024 tokens

Available Variants

FileQuantSizeEncoder cos vs F32Notes
ppformulanet-l-f16.ggufFP16347 MBbaselineFull precision
ppformulanet-l-q8_0.ggufQ8_0241 MB0.999940Critical tensors in F16
ppformulanet-l-q4_k.ggufQ4_K122 MB0.997595Desktop/mobile target

All three produce identical decoded LaTeX on test formulas.

Recommended: ppformulanet-l-q8_0.gguf (241 MB) — near-lossless quality at 1.4x compression vs F16.

For mobile/desktop: ppformulanet-l-q4_k.gguf (122 MB) — good quality at 2.8x compression.

Quantization Strategy

Q8_0 mode keeps critical tensors in FP16 for quality:

  • Embeddings (token, position, patch)
  • LayerNorm weights/biases
  • Relative position bias tables (tiny, critical for attention geometry)
  • LM head (determines output tokens)
  • Neck and projector weights (encoder-decoder bottleneck)

Large attention/MLP weight matrices are quantized to Q8_0.

Q4_K mode uses CrispEmbed's crispembed-quantize tool (K-quant with importance-weighted groups). LayerNorm and biases stay in F16; large matrices go to Q4_K.

Usage with CrispEmbed

# CLI — auto-detected from GGUF metadata
crispembed -m ppformulanet-l-q8_0.gguf --ocr formula.png

# Output: LaTeX string
# \zeta_{0}(\nu) = -\frac{\nu\varrho^{-2\nu}}{\pi} ...

C API

#include "crispembed.h"

void *ctx = crispembed_math_ocr_init("ppformulanet-l-q8_0.gguf", 4);
int len;
const char *latex = crispembed_math_ocr_recognize(ctx, pixels, w, h, channels, &len);
printf("%s\n", latex);
crispembed_math_ocr_free(ctx);

Architecture auto-detection reads general.architecture = "ppformulanet_l" from GGUF metadata.

Image Preprocessing

The model expects UniMERNet-style preprocessing:

  1. Convert to grayscale, replicate to 3 channels
  2. Resize maintaining aspect ratio to fit 768x768
  3. Center-pad with black (0) to fill 768x768
  4. Normalize: mean=0.7931, std=0.1738

CrispEmbed handles this automatically when you pass raw image bytes.

Parity Verification

Tested against HuggingFace PPFormulaNetForConditionalGeneration reference:

MetricF32Q8_0Q4_K
Encoder cosine similarity0.9999620.9999400.997595
Top-1 token matchYesYesYes
Full decode matchYesYesYes

Credits

Conversion

# F16
python models/convert-ppformulanet-l-to-gguf.py \
    --model-dir PP-FormulaNet-L --output ppformulanet-l-f16.gguf --fp16

# Q8_0 (critical tensors in F16)
python models/convert-ppformulanet-l-to-gguf.py \
    --model-dir PP-FormulaNet-L --output ppformulanet-l-q8_0.gguf --q8_0

# Q4_K (from F16 via C quantizer)
crispembed-quantize ppformulanet-l-f16.gguf ppformulanet-l-q4_k.gguf q4_k

Provenance and EU AI Act Art. 53 note

  • Upstream model: PaddlePaddle/PP-FormulaNet-L_safetensors — published by PaddlePaddle.
  • Upstream licence: apache-2.0. 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. No training-content summary was found on the upstream model card at the time of writing; that documentation gap is upstream's and is not filled here.
  • 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.

Sources

1 source
Hugging FacePrimaryVersion e97569b0291235cce068b23c6a6551e54849e342
huggingface.co/cstr/ppformulanet-l-gguf/tree/e97569b0291235cce068b23c6a6551e54849e342

Verified Oct 30

Download files

Repository files

File inventory only; completeness is unverified.

Model artifacts

3 artifacts

ppformulanet-l-f16.gguf

gguf · 346 MB · SHA-256 0fca3e79d7d0…1f99 · Hugging Face

Download file

ppformulanet-l-q4_k.gguf

gguf · 121 MB · SHA-256 b196a52829f5…2850 · Hugging Face

Download file

ppformulanet-l-q8_0.gguf

gguf · 240 MB · SHA-256 a56093227563…6839 · Hugging Face

Download file

Source excerpts

3 excerpts

--- license: apache-2.0 library_name: gguf pipeline_tag: image-to-text tags: - latex-ocr - math - formula-recognition - gguf - crispembed - ppformulanet - sam-vit - mbart base_model: PaddlePaddle/PP-FormulaNet-L_safetensors --- # PP-FormulaNet-L GGUF — Printed Math OCR GGUF-quantized versions of [PaddlePaddle's PP-FormulaNet-L](https://huggingface.co/PaddlePaddle/PP-FormulaNet-L_safetensors) for on-device printed formula recognition (image to LaTeX). ## Model Description | Property | Value | |---|---| | Architecture | SAM-ViT encoder + MBart Transformer decoder | | Parameters | 181M | | Input | 768x768 RGB image | | Output | LaTeX token sequence | | Vocab | 50,000 tokens (NougatTokenizer / BPE) | | License | **Apache-2.0** | ### Encoder: SAM-style Vision Transformer | Property | Value | |---|---| | Type | SAM ViT-B (from PaddleOCR Vary_VIT_B_Formula) | | Layers | 12 | | Hidden dim | 768 | | Heads | 12 | | MLP dim | 3072 | | Patch size | 16x16 (48x48 patches) | | Attention | Windowed (ws=14) on layers 0,1,3,4,6,7,9,10; Global on layers 2,5,8,11 | | Position bias | Decomposed relative position (per-axis, interpolated) | | Neck | Conv1x1 + LayerNorm2d + Conv3x3 + LayerNorm2d (768 -> 256) | | Projector | 2x Conv3x3(stride=2) + 2x Linear (256 -> 512). Output: 144 tokens x 512d | ### Decoder: MBart (Pre-LayerNorm) | Property | Value | |---|---| | Layers | 8 | | Heads | 16 | | d_model | 512 | | FFN dim | 2048 | | Activation | GELU | | Embedding | scale_embedding = sqrt(512) | | Max length | 1024 tokens | ## Available Variants | File | Quant | Size | Encoder cos vs F32 | Notes | |---|---|---|---|---| | `ppformulanet-l-f16.gguf` | FP16 | 347 MB | baseline | Full precision | | `ppformulanet-l-q8_0.gguf` | Q8_0 | 241 MB | 0.999940 | Critical tensors in F16 | | `ppformulanet-l-q4_k.gguf` | Q4_K | 122 MB | 0.997595 | Desktop/mobile target | All three produce **identical decoded LaTeX** on test formulas. **Recommended: `ppformulanet-l-q8_0.gguf`** (241 MB) — near-lossless quality at 1.4x compression vs F16. **For mobile/desktop: `ppformulanet-l-q4_k.gguf`** (122 MB) — good quality at 2.8x compression. ### Quantization Strategy **Q8_0 mode** keeps critical tensors in FP16 for quality: - Embeddings (token, position, patch) - LayerNorm weights/biases - Relative position bias tables (tiny, critical for attention geometry) - LM head (determines output...

Source context: 250 downloads · 0 likes · Pipeline image-to-text · Library gguf · Repo cstr/ppformulanet-l-gguf

Source context: 552 downloads · 0 likes · Pipeline image-to-text · Library gguf · Repo cstr/ppformulanet-l-gguf