/ Модель

Характеристики

Контекст
128 000 токенов
Параметры
445 млн
Лицензия
Своя лицензия
Архитектура
lfm2 · dense
Базовая модель
LFM2.5-350M
Библиотека
transformers
Опубликована
2 ноя 2026

receipt-extractor-lfm2.5-350m

Генерация текстаТекст → текст3 профессии

Дообученная компактная текстовая модель преобразует OCR-текст чека в JSON с позициями, сборами и итоговой суммой для локальных приложений учёта расходов.

328скачиваний за 30 дней0лайковвеса обновлены2 ноя 2026

Бенчмарки

Как модель справилась с задачами пользователей ailist и что о ней публикуют открытые лидерборды

Тесты пользователейпока нет

Никто ещё не опубликовал тест этой модели. Соберите бенчмарк из своих задач — результат появится здесь.

  1. Добавьте модель в бенчмарк

    Вместе с другими моделями категории «Текст» — сравнение идёт внутри одной категории.

  2. Опишите свои задачи

    Напишите запросы, при необходимости приложите файлы и эталонные ответы.

  3. Запустите и опубликуйте

    Модели ответят на каждую задачу, судья оценит ответы. Опубликованный результат появится на этой странице.

Публичные оценки

Из открытых лидербордов. Сравнивайте результаты одного теста при одинаковых условиях — отсутствие оценки не значит, что модель хуже.

В подключённых источниках результатов для этой модели пока нет.

Что умеет модель

Описание составлено по карточке модели и метаданным Hugging Face

Ajay0007 разработал компактную модель извлечения данных из чеков на основе Liquid AI LFM2.5-350M, полностью дообученной на 1 813 примерах из CORD-v2 и WildReceipt. Модель принимает распознанный OCR-текст чека, где каждая строка соответствует визуальной строке, и генерирует JSON с позициями, количеством и ценами, подытогом, налогом, сервисным сбором или чаевыми, скидкой и итоговой суммой. Это текстовая модель: фотографию следует сначала обработать отдельной системой OCR.

Модель рассчитана на локальную работу в приложениях для счёта и разделения расходов. В репозитории есть сборка int8 для LiteRT-LM размером 364 МБ; автор приводит медианную задержку около 0,8 секунды и p90 1,9 секунды на серверном CPU с четырьмя потоками. На тестах результаты заметно различаются по наборам: например, доля чеков, готовых к разделению без правок, составила 77,5% на CORD-v2 и 30,9% на WildReceipt. Лицензия указана как other, поэтому условия использования следует уточнить по карточке модели.

Сценарии применения

  • Извлечение позиций и цен из распознанного текста чека
  • Подготовка чека к разделению счёта по отдельным позициям
  • Извлечение налога, чаевых, скидки и итоговой суммы
  • Проверка суммы чека в приложении после OCR
  • Локальная обработка чеков в мобильном приложении

Ограничения

Качество зависит от OCR и формата строк; на реальных фотографиях доля чеков, готовых к разделению без исправлений, невысока. Кириллические и другие нелатинские письменности не представлены в обучающих данных; рукописные чеки, счета и многостраничные документы не поддерживаются, а результаты требуют проверки и не предназначены для бухгалтерского или налогового учёта без неё.

Для каких профессий подходит3

Разделы каталога профессий, в задачах которых используется эта модель

Все профессии

Карточка модели

README от автора на Hugging Face, как он его опубликовал

Открыть на Hugging Face

receipt-extractor-lfm2.5-350m

Turn a receipt into structured JSON on the phone. This small model reads the OCR text of a receipt photo and returns line items, subtotal, tax, service charge/tip, discount and total as JSON. Built for an on-device, Splitwise-style "snap the bill and split it by item" app.

  • Base model: LiquidAI/LFM2.5-350M (354M parameters), fully fine-tuned
  • Input: OCR text of a receipt (one visual line per row), from Google ML Kit (Android), Apple Vision (iOS), PaddleOCR, etc.
  • Output: compact JSON: {"items":[{"name","qty","price"}], "subtotal", "tax", "service", "discount", "total"}
  • On-device: includes model.litertlm (int8, 364 MB) for Google's LiteRT-LM runtime (Android, iOS, desktop)
  • Speed: median 0.8 s, p90 1.9 s per receipt in the official LiteRT-LM runtime (int8, 4 CPU threads on a server CPU, excluding OCR). Expect similar or better on a recent phone; please benchmark on your target devices.

How it fits in an app

photo ──► on-device OCR (ML Kit / Apple Vision, ~0.3 s) ──► this model (~1 s) ──► JSON ──► sum check ──► split UI
                                                                                   └─ fails → ask the user to review

The sum check (do item prices + tax + service − discount equal the total?) is a strong confidence signal: in our tests, receipts that pass it were fully correct ~89% of the time, versus ~25% for receipts that fail it. receipt_utils.sum_check() in this repo implements it.

Quick start (Python / transformers)

from transformers import AutoModelForCausalLM, AutoTokenizer
from huggingface_hub import hf_hub_download
import importlib.util, sys

repo = "Ajay0007/receipt-extractor-lfm2.5-350m"
tok = AutoTokenizer.from_pretrained(repo)
model = AutoModelForCausalLM.from_pretrained(repo)

# helper functions shipped with the model (prompt, OCR line grouping, JSON parsing, sum check)
spec = importlib.util.spec_from_file_location("receipt_utils", hf_hub_download(repo, "receipt_utils.py"))
ru = importlib.util.module_from_spec(spec); spec.loader.exec_module(ru)

ocr_text = """1 EGG TART 13,000
2 CHOCO CUSTARD PASTRY 24,000
REDBEAN BREAD 9,000
TOTAL 46,000
CASH 50,000
CHANGE 4,000"""

messages = [{"role": "user", "content": ru.build_prompt(ocr_text)}]
inputs = tok.apply_chat_template(messages, add_generation_prompt=True, return_dict=True,
                                 return_tensors="pt")
out = model.generate(**inputs, max_new_tokens=768, do_sample=False)
receipt = ru.parse_output(tok.decode(out[0, inputs["input_ids"].shape[1]:], skip_special_tokens=True))
print(receipt)
print("sum check passed:", ru.sum_check(receipt))

Output for the example above:

{"items": [{"name": "EGG TART", "qty": "1", "price": "13,000"}, {"name": "CHOCO CUSTARD PASTRY", "qty": "2", "price": "24,000"}, {"name": "REDBEAN BREAD", "qty": "1", "price": "9,000"}], "total": "46,000"}

Use the prompt exactly as build_prompt writes it. The model was trained on that wording. Use greedy decoding (do_sample=False).

Getting OCR text in the right format

The model expects one visual receipt line per row, with the tokens on a line ordered left to right (so an item name and its price sit on the same row). Raw OCR engines return boxes, not lines. Use receipt_utils.ocr_boxes_to_text([(x_min, y_min, y_max, text), ...]), which is the same grouping used to build the training data. Port this ~20-line function to Kotlin/Swift for your app.

On-device: LiteRT-LM (Android / iOS)

model.litertlm is an int8 build (weights int8, activations fp32) made with litert-torch (dynamic_wi8_afp32, prefill 256, KV cache 1024 tokens). Measured on 100 receipts per set in the LiteRT-LM runtime (4 CPU threads): CORD split-ready 70% / total 94%, WildReceipt split-ready 31% / total 88%. That is within ~1 point of the bf16 weights on the same receipts, so int8 conversion costs essentially no accuracy. Latency: median 0.82 s, p90 1.90 s.

import litert_lm                                 # pip install litert-lm-api
from huggingface_hub import hf_hub_download
path = hf_hub_download("Ajay0007/receipt-extractor-lfm2.5-350m", "model.litertlm")
engine = litert_lm.Engine(path, backend=litert_lm.Backend.CPU(thread_count=4), max_num_tokens=2048)
conv = engine.create_conversation(sampler_config=litert_lm.SamplerConfig(top_k=1, temperature=0.0),
                                  max_output_tokens=768)
reply = conv.send_message(ru.build_prompt(ocr_text))
print(reply["content"] if isinstance(reply, dict) else reply)

For apps, load the same file with the LiteRT-LM Kotlin API (Android, stable) or Swift API (iOS), or use the Google AI Edge Gallery app to try it on a phone and see its speed.

Training data

DatasetReceipts usedRegion / languageLabels used
CORD-v2 (CC-BY-4.0), train split800Indonesia (Indonesian/English, IDR)items, priced add-ons, subtotal, tax, service, discount, total
WildReceipt, train split1,013mostly US/EU photos (English, some German/French)items, subtotal, tax, tip→service, total
Total1,813

Inputs were produced by running RapidOCR (PP-OCR) on the images, so the model learned from realistic, noisy OCR, not clean ground-truth text. CORD labels were corrected: priced add-ons stored as sub-items in CORD (e.g. "Extra Jelly 5,000") were restored, and a few annotation errors fixed. Store names, addresses, dates and payment lines (cash, change, card) are deliberately not extracted.

Training procedure

Full fine-tune (all weights) with plain supervised next-token loss on the assistant JSON only (prompt tokens masked).

SettingValue
Epochs5
Learning rate / schedule5e-5, cosine, 5% warmup
Batch size8
Max sequence length2,048 tokens
Precisionbf16, gradient checkpointing
Hardware / time1× NVIDIA A40, ~6 min
Target formatcompact JSON, null fields dropped (shorter output = faster on device)

We also tested LoRA (r=16, all linear layers, lr 2e-4): it matched the full fine-tune on CORD (70% vs 72% split-ready) and is a good option if you want small swappable adapters.

Evaluation

All numbers use OCR from RapidOCR, greedy decoding and the bf16 weights unless noted. Split-ready = every line item (name + price) and the total are exactly right, so the bill can be split with no edits. Item F1 = item matched on name (fuzzy ≥ 80) and exact price. Amounts are compared by value (60.000 = 60,000, 525 = 525.00).

This model

Test setItem F1Total correctSplit-ready
CORD-v2 test+val, corrected labels (200, Indonesia)86.3%95.9%77.5%
WildReceipt test (472, US/EU photos)57.3%88.4%30.9%
SROIE test (347, Malaysia, total only) — unseen dataset–85.0%–
Real-world photos, Latin script (30, Wikimedia Commons, hand-verified) — unseen29.5%50.0%13.3%
Real-world photos, CJK/Thai/Cyrillic (33, VLM-labeled) — unseen17.1%54.5%12.1%

Compared with other small models (same pipeline, same test sets)

ModelTrained onCORD split / totalWildReceipt split / totalSROIE totalPhotos split / totalSize
Donut-base CORD-v2 (public, image→JSON)CORD82 / 981 / 54310 / 13~200M params
Gemma 3 270MCORD64 / 934 / 48330 / 20~290 MB
LFM2.5-350MCORD73 / 942 / 40190 / 13364 MB
Qwen3-0.6BCORD76 / 9310 / 64493 / 47614 MB
LFM2-VL-450M (image→JSON)CORD74 / 923 / 52437 / 47~450M params
LFM2.5-350M — oursCORD-fixed + WildReceipt78 / 9631 / 888513 / 50364 MB
Qwen3-0.6B — oursCORD-fixed + WildReceipt76 / 9437 / 918637 / 57614 MB
LFM2-350M-Extract, zero-shot—2 / 342 / 1626– / –364 MB

Key takeaways:

  • Models trained only on CORD don't generalize. Every CORD-only model, including the public Donut-CORD, gets ≤10% split-ready on US/EU receipts. Adding WildReceipt raised WildReceipt totals from ~40–65% to ~90%, and SROIE (never seen in training) from ~20–50% to ~85%.
  • The int8 LiteRT build was evaluated separately; see the on-device section.
  • Seed-to-seed variation is about ±1–3 points; the 30-photo set has about ±9 points of noise.

Limitations

  • Real-world photos are still hard. On real phone photos, about 1 in 3 come out fully split-ready and about 1 in 2 have the right total. Typical failures:
    • totals labeled with keywords unseen in training ("Celkem", "SUMA PLN", "NET A PAYER") get omitted;
    • the OCR misses or garbles the total (OCR quality caps accuracy, and the model copies OCR errors);
    • item names and prices on separate lines of tall receipts get mis-paired.
  • Non-Latin scripts (Japanese, Chinese, Thai, Cyrillic) were not in the training data: totals are often right, but items rarely are.
  • Amounts are copied as printed (strings with the receipt's own separators and currency marks). Normalize them in the app (receipt_utils.to_number).
  • Handwritten bills, invoices and multi-page documents are out of scope.
  • Do not use the output for accounting or tax purposes without review.

Improve it for your users: fine-tune further on a few hundred labeled receipts from your target countries. In our experiments, adding diverse data mattered far more than model size.

License

LFM Open License v1.0: free for commercial use by organizations with < USD 10M annual revenue; larger organizations need a separate license from Liquid AI. Fine-tuning data: CORD-v2 (CC-BY-4.0) and WildReceipt. This repository contains modified weights (fine-tuned) of LiquidAI/LFM2.5-350M.

Как запустить

На своей GPU в ailist. Цена — по текущим предложениям провайдеров

GPU в ailist

Универсальный рантайм · transformers

Можно запустить

Подбираем GPU…

Класс архитектуры
Lfm2ForCausalLM
Ревизия весов
1b6b94a

0 моделей