TinyDoc-VLM

The World's Smallest Document-Specialist VLM โ€” 256M parameters, runs on a Raspberry Pi, open-source.

GitHub stars PyPI HF Model HF Space License

๐Ÿ”ฅ Highlights

๐Ÿง 

256M Parameters

SigLIP-B/16 vision encoder + Pixel-Shuffle compressor + SmolLM2-135M decoder. Optimized for edge.

๐Ÿ“ฑ

<1GB VRAM

Runs on Raspberry Pi 5, MacBook Air, or any CPU with ONNX export. Over 100 tok/s on CPU.

๐Ÿ“‹

Structured Output

JSON extraction, key-value pairs, table parsing, OCR, and VQA โ€” all from a single unified model.

๐ŸŽ“

3-Stage Training

Layout pretrain โ†’ Document understanding โ†’ Instruction tuning on 10K+ synthetic documents.

๐Ÿ“ฆ

One pip Install

pip install tinydoc โ€” Python SDK with Pydantic-typed results. PyTorch and ONNX backends.

๐Ÿค—

Open Weights

Pre-trained weights on HuggingFace Hub. Apache 2.0 license โ€” free for commercial use.

๐Ÿš€ Quick Start

# Install the SDK
pip install tinydoc

# Use it in Python
from PIL import Image
from tinydoc import TinyDocExtractor

extractor = TinyDocExtractor(device="cpu")
img = Image.open("invoice.png")

# Ask a question
result = extractor.ask(img, "What is the total?")
print(result.answer)

# Extract JSON fields
result = extractor.extract(img, output_format="json")
print(result.fields)

# Extract tables
result = extractor.extract_table(img)
print(result.markdown)

๐Ÿ—๏ธ Architecture

Image (384ร—384)
    โ†“
SigLIP Vision Encoder (93M)           โ† 576 patches ร— 768 dim
    โ†“
Pixel-Shuffle Compressor (scale=3)    โ† 9ร— compression โ†’ 64 tokens
    โ†“
Visual Position Embeddings
    โ†“
SmolLM2 Decoder (135M)                โ† 30 layers, GQA (9:3 heads), 8192 ctx
    โ†“
Multi-Task Output Heads
    โ†“
JSON / KV Extraction / Table / OCR / QA

๐Ÿ“Š Benchmarks

BenchmarkMetricScoreStatus
DocVQAANLSโ€”โณ Running
FUNSDF1โ€”โณ Running
CORDF1โ€”โณ Running
SROIEF1โ€”โณ Running
PubTabNetTEDSโ€”โณ Running