Reflex-2B

Reflex-2B

Reflex-2B extracts structured data from documents. Give it a page (a photo, scan, screenshot, PDF or text) and the fields you need; it returns one JSON object with typed values.

  • Size: 2B parameters.
  • Field types: text, number, date, time, datetime, boolean, enum, object, list.
  • Output: JSON matching the schema. Missing values are null; dates are ISO 8601.

What it's for

  • Invoices, receipts, purchase orders and other business documents
  • Phone photos, scans and handwritten documents
  • Multi-page PDFs with long tables
  • Answering questions about a page
  • Pulling typed fields out of emails, contracts and other text

You define the fields; there is no fixed schema.

Results

Benchmark Metric Reflex-2B Clairic Flash 9B
SROIE 2019 test (240 receipts) Fields correct 92.6% 89.3%
DocVQA validation (500 questions) ANLS 0.933 0.920

Both models were run on the same documents with the same scorer.

Usage

Serve the model with vLLM:

vllm serve gradients-ai-1/Reflex-2B --trust-remote-code --max-model-len 16384

Then extract with reflex_runtime, the small Python package that ships in this repository:

pip install huggingface_hub pillow pypdfium2
import sys
from huggingface_hub import snapshot_download

sys.path.insert(0, snapshot_download("gradients-ai-1/Reflex-2B", allow_patterns=["reflex_runtime/*"]))

from reflex_runtime import Extractor
from reflex_runtime.backends import OpenAIBackend

ex = Extractor(OpenAIBackend())   # vLLM on localhost:8000, serving gradients-ai-1/Reflex-2B

ex.extract(source, fields) accepts a PDF, an image file, a PIL image, a list of page images, a text file or a plain string. Every call returns result.answer (the JSON), result.confidence (per value) and result.pages (the page each value came from).

Phone photo of a receipt

result = ex.extract("receipt.jpg", {
    "store_name": {"type": "text"},
    "date":       {"type": "date"},
    "total":      {"type": "number", "description": "Amount paid, including tax"},
})
# {"store_name": "ใƒ‹ใƒˆใƒช", "date": "2026-09-05", "total": 1210}

Scanned or digital PDF, several pages

result = ex.extract("statement.pdf", {
    "account_holder": {"type": "text"},
    "period_end":     {"type": "date"},
    "transactions": {"type": "list", "items": {"type": "object", "fields": {
        "date":        {"type": "date"},
        "description": {"type": "text"},
        "amount":      {"type": "number", "description": "Negative for money going out"},
    }}},
})
len(result.answer["transactions"])   # rows from every page, in order
result.pages["period_end"]           # page the value was read from

Pages with a text layer are read as text and scanned pages as images. Pass mode="image" or mode="text" to force one.

Several photos of one document

result = ex.extract(["page1.jpg", "page2.jpg", "page3.jpg"], fields)

Each photo is treated as one page, in the order given.

Plain text: an email

email = """Hi team, please book the venue for our offsite next Friday.
Budget is EUR 4,500 for 25 people. Contact: Maria Lopez, +34 600 123 456."""

result = ex.extract(email, {
    "event_date":  {"type": "date", "description": "Date of the event"},
    "budget":      {"type": "number"},
    "currency":    {"type": "text", "description": "ISO 4217 code"},
    "attendees":   {"type": "number"},
    "contact_name": {"type": "text"},
}, reference_date="2026-11-23")
# {"event_date": "2026-11-27", "budget": 4500, "currency": "EUR", "attendees": 25, "contact_name": "Maria Lopez"}

reference_date lets the model resolve relative dates such as "next Friday".

Screenshot or image already in memory

from PIL import Image

result = ex.extract(Image.open("screenshot.png"), {
    "order_id":      {"type": "text"},
    "delivery_date": {"type": "date"},
    "items_count":   {"type": "number"},
})

Questions about a page

A field's description can be a question:

result = ex.extract("letter.jpg", {
    "university": {"type": "text", "description": "What is the name of the university?"},
    "signed":     {"type": "boolean", "description": "Is the letter signed?"},
})
result.answer["university"]   # "University of California, San Diego"

Decisions and categories from a contract

result = ex.extract("contract.txt", {
    "contract_type":  {"type": "enum", "options": ["employment", "lease", "services", "nda", "other"]},
    "auto_renews":    {"type": "boolean"},
    "notice_period_days": {"type": "number"},
    "governing_law":  {"type": "text", "description": "Country or state whose law applies"},
})

Without a server (transformers)

from reflex_runtime import Extractor
from reflex_runtime.backends import HFBackend   # also needs: pip install torch transformers xgrammar

ex = Extractor(HFBackend())
result = ex.extract("invoice.png", {"invoice_number": {"type": "text"}, "total": {"type": "number"}})

vLLM is faster for batches and long documents; transformers is simpler for a quick test.

Defining fields

Each field has a type and an optional description. A short description of what the field means usually helps more than a precise name.

fields = {
    "vendor_name":  {"type": "text", "description": "Company that issued the invoice"},
    "invoice_date": {"type": "date"},
    "currency":     {"type": "enum", "options": ["USD", "EUR", "GBP", "other"]},
    "is_paid":      {"type": "boolean", "description": "True if the invoice is marked as paid"},
    "bill_to": {"type": "object", "fields": {
        "name":    {"type": "text"},
        "address": {"type": "text"},
    }},
    "line_items": {"type": "list", "items": {"type": "object", "fields": {
        "description": {"type": "text"},
        "quantity":    {"type": "number"},
        "amount":      {"type": "number"},
    }}},
}
Type Returned as
text string, as written in the document
number plain number, no currency symbols or thousands separators
date, time, datetime ISO 8601 string
boolean true or false
enum one of the listed values
object nested object with its own fields
list array of values or objects, in document order

Any field the document doesn't contain comes back as null rather than a guess.

Confidence scores

With reflex_runtime, every value gets two numbers:

  • confidence: how likely the value is to be correct, from 0 to 1
  • p_null: how likely it is that the field is missing from the document
{"total": {"confidence": 0.93, "p_null": 0.0},
 "due_date": {"confidence": 0.41, "p_null": 0.55}}

A practical setup is to accept values at or above 0.95 automatically and send the rest for review.

Multi-page documents

Send one page per request. reflex_runtime does this for you: it reads each page, joins tables that continue across pages in order, and removes repeated header rows and carried-forward totals.

Hardware

The weights are about 3.8 GB. Reflex-2B runs on a single GPU and was tested on an NVIDIA L4 (24 GB) with vLLM.

License

Reflex-2B is a derivative of LFM3-VL-2B, modified by fine-tuning, and is distributed under the LFM Open License v1.0.

Citation

@misc{reflex2b,
  title  = {Reflex-2B: structured data extraction from documents},
  author = {Gradients AI},
  year   = {2026},
  url    = {https://huggingface.co/gradients-ai-1/Reflex-2B}
}
Downloads last month
12
Safetensors
Model size
2B params
Tensor type
BF16
ยท
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for gradients-ai-1/Reflex-2B

Finetuned
(26)
this model
Quantizations
1 model