/ Модель

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

Контекст
514 токенов
Параметры
305 млн
Архитектура
xlm-roberta · dense
Базовая модель
xlm-roberta-base
Библиотека
transformers
Опубликована
9 окт 2026

XLM-RoBERTa-CompanyDocs-v2

Классификация текстаТекст → label5 профессий

Дообученная многоязычная XLM-RoBERTa классифицирует извлечённый текст деловых документов по типу для маршрутизации и выбора последующей обработки.

40скачиваний за 30 дней0лайковвеса обновлены12 окт 2026

Бенчмарки

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

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

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

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

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

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

Ayoub Cherguelaine (AyoubChLin) разработал CompanyDocs XLM-RoBERTa v2 — дообученную XLM-RoBERTa с классификационной головой для определения типа делового документа по извлечённому тексту. Модель содержит 305,2 млн параметров, принимает текст и обрабатывает до 514 токенов контекста; в обучении и оценке использовались английский и французский языки.

Модель предназначена для маршрутизации и индексирования документов, а также для выбора последующего процесса извлечения данных. Обучение проводилось на Company-document-dataset-v2; среди описанных категорий — счета, заказы на закупку, коммерческие предложения, чеки и транспортные документы. В отчёте о тестировании на этом наборе указаны 100% accuracy и macro-F1, но это не подтверждает аналогичное качество на реальных данных.

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

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

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

Ограничения

Модель обрабатывает только текст, ограниченный первыми 512 токенами; качество зависит от ошибок OCR и может снизиться, если важные признаки находятся дальше по документу. Она всегда выбирает метку из закрытого набора, оценки не подтверждены как калиброванные вероятности, а результаты тестирования на датасете не гарантируют качество на реальных документах.

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

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

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

Также подходит для

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

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

Открыть на Hugging Face

CompanyDocs XLM-RoBERTa v2

Classify business documents from their extracted text. CompanyDocs XLM-RoBERTa v2 is a fine-tuned XLM-RoBERTa model for identifying document types such as invoices, purchase orders, quotes, receipts, and shipping orders.

It was trained on CompanyDocuments v2, using the dataset's file_content field as input and document_type as the target. The uploaded training notebook reports 100.00% test accuracy, 100.00% macro-F1, and approximately 278.1 million parameters.

The training data includes English and French documents. The recorded run reports perfect test scores in both languages. These results describe this benchmark and do not establish perfect performance on real-world documents.

Model details

PropertyValue
AuthorAyoub Cherguelaine (AyoubChLin)
Base checkpointFacebookAI/xlm-roberta-base
ArchitectureXLM-RoBERTa with a sequence classification head
TaskSingle-label document type classification
InputExtracted document text
OutputA document type label and model score
Maximum input length512 tokens, including special tokens
ParametersApproximately 278.1M
Training frameworkPyTorch and Hugging Face Transformers Trainer

Dataset and training relationship

Training dataset: AyoubChLin/Company-document-dataset-v2, configuration all.

The training pipeline reads three fields:

  • file_content: text extracted from the document.
  • document_type: the classification target.
  • locale: used for language-specific evaluation, rather than as a model input.

Empty texts are removed. Documents are tokenized with truncation at 512 tokens, preserving the beginning of each document. Batches use dynamic padding. The classifier does not consume embedded PDFs, document images, bounding boxes, or structured extraction annotations.

The recorded run contains these split sizes:

SplitDocumentsEnglishFrench
Train259,497163,99495,503
Validation47,11430,16716,947
Test46,9699,49637,473

The notebook describes the dataset splits as grouped by issuing company, with unseen issuers in validation and test. This grouping is a property of the dataset's provided splits; the notebook does not independently audit it. Its saved output reports no classes missing from training, so no class redistribution occurred in that recorded run.

Document types

The notebook's saved training output lists 13 labels:

ID in the recorded runLabel
0account_statement
1credit_note
2employment_certificate
3goods_received_note
4inventory_report
5invoice
6packing_slip
7payslip
8purchase_order
9quote
10receipt
11shipping_order
12work_order

Checkpoint verification: the notebook's current source also contains an unexecuted rare-class filter that would remove four of these labels. Its saved outputs still show 13 labels and the full split sizes. This card documents those recorded outputs. For the downloaded checkpoint, treat model.config.id2label as authoritative; verify it against this table before publishing the card as checkpoint-verified documentation.

Evaluation

Results below come from the XLM-RoBERTa entry in the uploaded notebook's saved outputs. They are not a new evaluation of the hosted checkpoint.

Test metricResult
Accuracy100.00%
Macro-F1100.00%
Weighted-F1100.00%
Macro precision100.00%
Macro recall100.00%
English accuracy100.00%
French accuracy100.00%

The test set contains substantially more French documents than English documents. Macro-F1 gives each class equal weight and is useful here because the class distribution is highly uneven: the recorded test set includes 6,807 purchase orders but only 10 inventory reports. Perfect scores on this dataset warrant further testing on independent documents, noisy OCR, and examples without explicit document titles. No independent leakage or duplicate audit was supplied.

The notebook also reports a training time of approximately 14.3 minutes, peak allocated GPU memory of 31.0 GB, and approximately 1,269.7 test documents/second. These measurements belong to that notebook run, configured for a single A100 80 GB GPU. Throughput was measured using batched Trainer.predict; it is not a guarantee of service latency or CPU performance.

Training configuration

The notebook source specifies the following configuration:

SettingValue
Epochs1
Learning rate3e-5
Training batch size128
Evaluation batch size256
Gradient accumulation steps1
Optimizer on CUDAFused AdamW (adamw_torch_fused)
Weight decay0.01
Learning rate scheduleLinear
Warmup10% of configured training steps
Random seed42
Checkpoint selectionBest validation macro-F1
PrecisionBF16 when supported on CUDA; otherwise FP16 on CUDA

Exact package versions, dataset commit, and hosted checkpoint commit were not recorded in the information used to prepare this card.

Quick start

pip install torch transformers
import torch
from transformers import pipeline

# Current repository ID. After renaming the repository, use:
# MODEL_ID = "AyoubChLin/companydocs-xlm-roberta-v2"
MODEL_ID = "AyoubChLin/companydocs-v2-doc-cls-xlm-roberta"

classifier = pipeline(
    "text-classification",
    model=MODEL_ID,
    device=0 if torch.cuda.is_available() else -1,
)

texts = [
    "INVOICE\nInvoice number: INV-1042\nTotal amount due: EUR 1,250.00",
    "PURCHASE ORDER\nPO number: PO-218\nPlease supply 20 office chairs.",
]

predictions = classifier(texts, truncation=True, max_length=512)
for prediction in predictions:
    print(prediction["label"], prediction["score"])

# Inspect the labels actually supported by this checkpoint.
print(classifier.model.config.id2label)

Extract text from a PDF or run OCR before passing the resulting string to the classifier. The examples above illustrate the interface; their predictions are not precomputed benchmark results.

Intended uses and limitations

Use this model for document routing, indexing, and selecting a downstream extraction workflow based on a predicted document type.

  • Language coverage: training and evaluation cover English and French. Other languages were not evaluated in the recorded run.
  • Benchmark scope: both English and French accuracy are 100% in the recorded run. Evaluate each language on representative production documents before deployment.
  • Text only: the model does not process visual layout, handwriting, or raw PDF files. OCR errors can change its predictions.
  • Truncation: content after the first 512 tokens is omitted. Documents whose identifying information appears later may be misclassified.
  • Closed label set: an unsupported document type will still receive a supported label. There is no trained unknown-document class.
  • Benchmark shortcuts: document titles such as “INVOICE” or “FACTURE” may make classification easier. Issuer-separated splits alone do not establish robustness to missing titles, new templates, or noisy real-world scans.
  • Scores: prediction scores have not been shown to be calibrated probabilities. Validate any review threshold on representative deployment data.

License and provenance

The repository's current license could not be verified when preparing this card, so no license is asserted in the metadata. Check the model repository's license and the dataset card before reuse or redistribution.

Training settings, label lists, and results are sourced from companydocs-v2-doc-classification.ipynb. Its saved outputs and current source are not fully synchronized, including a later error-analysis cell reporting a different test size. The results here use the XLM-RoBERTa training/evaluation output and its associated recorded split counts. Verify the hosted model configuration and rerun evaluation against a pinned dataset revision to establish fully reproducible checkpoint-specific results.

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

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

GPU в ailist

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

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

Подбираем GPU…

Класс архитектуры
XLMRobertaForSequenceClassification
Ревизия весов
a32b4da

0 моделей