/ Модель

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

Контекст
2 048 токенов
Параметры
151 млн
Лицензия
Apache 2.0
Архитектура
ultrabert · dense
Базовая модель
UltraBERT-150M
Библиотека
transformers
Опубликована
21 окт 2026

UltraBERT-150M-clairic-extraction

Заполнение пропусковТекст → текст7 профессий

Англоязычная модель извлекает из текста фрагменты, отвечающие инструкциям в форме вопросов или типов сущностей.

217скачиваний за 30 дней5лайковвеса обновлены21 окт 2026

Бенчмарки

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

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

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

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

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

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

UltraBERT-150M-clairic-extraction — англоязычный экстрактор на базе UltraBERT-150M, разработанный tasksource. Модель дообучена размечать фрагменты входного текста по краткой инструкции: инструкция может быть вопросом или названием типа сущности. Для каждого поля она возвращает один или несколько найденных фрагментов либо пустой ответ, поэтому подходит для извлекающего ответа на вопросы и распознавания именованных сущностей.

Модель содержит 151 млн параметров, принимает пары «инструкция — текст» и обрабатывает последовательности до 2048 токенов. В репозитории есть веса safetensors и экспорт ONNX; для запуска ONNX доступна int8-квантованная версия. Карточка сообщает о хороших результатах на тестовых наборах источников, использованных при обучении, но отмечает более низкие результаты на отдельном наборе typed-extraction и уступает специализированной модели на SQuAD 2.0. Экстрактор копирует ответы из текста и не умеет вычислять новые значения, например суммы или количества. Лицензия модели — Apache-2.0; лицензии отдельных обучающих наборов различаются.

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

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

Ограничения

Модель возвращает только фрагменты исходного текста и не вычисляет производные значения, такие как суммы, количества или интервалы дней. Результаты на обучающих источниках не гарантируют качество на новых задачах; динамическая int8-квантизация, согласно карточке, заметно ухудшает совпадение предсказаний.

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

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

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

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

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

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

Открыть на Hugging Face

UltraBERT-150M-clairic-extraction

A 150M-parameter extractor for Clairic-style requests: give it a text and a set of fields, each described by a short instruction, and it returns the matching spans for each field (one answer, a list, or nothing when the text has no answer). Fields can be questions ("What is the total due?") or entity types ("Every company mentioned in the text"), so one model covers extractive question answering and named-entity recognition.

UltraBERT-150M trained on the extraction config of tasksource-jev-typed-decisions: extractive QA and span-tagging datasets from tasksource, rewritten as (instruction, text, spans) pairs. The model tags the answer tokens of the text (B/I/O) conditioned on the instruction. Inputs up to 2048 tokens.

Not affiliated with Cloudflare; "Clairic-style" refers to the request format.

Try it in your browser: the int8 ONNX export below, run client-side with onnxruntime-web.

Usage

import torch
from transformers import AutoModelForTokenClassification, AutoTokenizer

name = "tasksource/UltraBERT-150M-clairic-extraction"
tok = AutoTokenizer.from_pretrained(name)
model = AutoModelForTokenClassification.from_pretrained(name, trust_remote_code=True).eval()

def extract(text, fields):
    """fields: {name: instruction}. Returns {name: [extracted spans]}, [] when the text has no answer."""
    enc = tok(list(fields.values()), [text] * len(fields), truncation="only_second", max_length=2048,
              padding=True, return_offsets_mapping=True, return_tensors="pt")
    offsets = enc.pop("offset_mapping")
    with torch.no_grad():
        tags = model(**enc).logits.argmax(-1).tolist()  # 0 = O, 1 = B, 2 = I
    out = {}
    for f, field in enumerate(fields):
        spans, start, seq = [], None, enc.sequence_ids(f) + [None]
        for i, tag in enumerate(tags[f] + [0]):
            if start is not None and (seq[i] != 1 or tag != 2):
                spans.append(text[offsets[f][start][0]:offsets[f][i - 1][1]].strip().rstrip(",;:"))
                start = None
            if seq[i] == 1 and tag in (1, 2) and start is None:
                start = i
        out[field] = spans
    return out

text = "Invoice INV-2291 from Acme Corp to Globex, issued 3 March 2025. Total due: $1,240.50. Contact: billing@acme.com."
print(extract(text, {
    "invoice_number": "The invoice number.",
    "companies": "Every company mentioned in the text, as written.",
    "total": "The total amount due.",
    "phone": "The contact phone number.",
}))
# {'invoice_number': ['INV-2291'], 'companies': ['Acme Corp', 'Globex'], 'total': ['$1,240.50'], 'phone': []}

trust_remote_code=True is needed for the UltraBERT architecture.

ONNX int8

onnx/model_quantized.onnx (204 MB, vs 604 MB in fp32) takes input_ids and attention_mask and returns the O/B/I logits. Linear weights are quantized to 8 bits per block of 32 (weight-only, MatMulNBits; activations stay in float) and the embedding table is stored in fp16. Its tags match the PyTorch model on 99.6% of tokens and on 100% of answer tokens in our checks, and it scores the same on the evaluation below (20 rows per source: QA F1 0.730 vs 0.728 for PyTorch fp16, list F1 0.701 vs 0.700); plain dynamic int8 quantization (int8 activations) breaks the model (78% agreement), so prefer this file to re-quantizing. Build the input as the tokenizer's pair template: <|endoftext|> instruction <|sep|> text.

import onnxruntime
from huggingface_hub import hf_hub_download

session = onnxruntime.InferenceSession(hf_hub_download(name, "onnx/model_quantized.onnx"))
enc = tok(list(fields.values()), [text] * len(fields), truncation="only_second", max_length=2048,
          padding=True, return_offsets_mapping=True, return_tensors="np")
tags = session.run(None, {"input_ids": enc["input_ids"], "attention_mask": enc["attention_mask"]})[0].argmax(-1).tolist()
# then read the spans off the text tokens as in extract() above (tags outside the text are meaningless)

LocalLLaMA/typed-extraction (zero-shot)

On the test split of LocalLLaMA/typed-extraction (1,690 documents, 17,733 typed fields), which this model never trained on. Scores come from its own score.py, and spans are mapped to typed values with plain code (numbers parsed, dates through dateutil). Submitted in discussion #1.

ModelHeadline ↑Fields with a value ↑Hallucination ↓Miss ↓Computed ↑
ScaleDown Extract (API)0.7820.7230.1170.2000.570
UltraBERT-150M-clairic-extraction0.6160.5480.1410.2970.014
Schematron V2 Small (LLM)0.5620.5290.4450.3030.134
Always null0.1990.0000.0001.0000.000

As an extractor, it can't compute values (totals, counts, day spans). Predictions are in eval/.

Evaluation

Test split of the extraction config (revision v2026.10.20.7), 100 rows per source. text fields (one answer or none) are scored by SQuAD F1, the empty answer counting as an answer. list fields (every span of a kind) are scored by micro F1 over normalized values. Scores are means over sources.

ModelParamsQA (28 sources, F1)NER / span lists (60 sources, F1)
UltraBERT-150M-clairic-extraction150M0.7200.702
gliner-multitask-large-v0.5440M0.4740.408
gliner_medium-v2.1209M0.3320.360
deberta-v3-base-squad2184M0.4980.060

The test sources are the training sources (their test splits), while the baselines see most of them zero-shot, so this measures performance on these tasks rather than on unseen ones. GLiNER reads about 384 words at a time and was given the field name as its label (the instruction for numbered questions); the QA models were given the instruction as the question and read long texts in overlapping windows. On SQuAD 2.0, deberta-v3-base-squad2, trained on it, stays ahead (0.876 vs 0.764).

SourceField typeclairic-extractiongliner-multitask-largegliner_mediumdeberta-squad2
adversarial-qatext0.3730.2510.0080.320
anatemlist0.7870.3050.3370.000
bc2gmlist0.7760.5060.5750.000
bc4chemdlist0.7780.5210.5610.092
bc5cdrlist0.8450.6410.6650.083
bioinfer/entitieslist0.4130.1170.3180.005
bionlp-cg/entitieslist0.7400.5460.3000.003
biored/entitieslist0.7750.3320.3070.006
broad-twitter-corpuslist0.6640.7270.7250.228
busterlist0.7200.5400.3950.047
concurrentqalist0.7680.5530.1000.516
conll04list0.8080.7020.7190.120
conll2000list0.9500.0300.0100.002
conll2003/ner_tagslist0.8940.7170.5840.219
crossner/ailist0.6500.6750.6670.075
crossner/literaturelist0.7600.7890.7370.064
crossner/musiclist0.7130.8500.8230.050
crossner/politicslist0.7980.8530.8060.036
crossner/sciencelist0.7350.7610.7550.036
cuad/spanslist0.4540.0250.0000.032
duorc/ParaphraseRCtext0.5170.4580.2900.385
duorc/SelfRCtext0.8320.7080.0770.519
ebm-nlp/interventionslist0.5200.1550.1630.000
ebm-nlp/outcomeslist0.4250.0310.0610.000
ebm-nlp/participantslist0.3050.0060.0570.006
fabnerlist0.6740.2680.1910.013
fairytaleqa/explicittext0.7430.5370.0000.627
fce/errorslist0.3770.0000.0000.000
few-nerd/supervisedlist0.7700.7250.6310.043
finer-139list0.9060.2220.1640.012
finer-ordlist0.8340.6720.6490.141
friendsqatext0.6600.3330.0050.486
gum-nerlist0.4250.2870.3830.032
harveynerlist0.4020.3210.3140.029
hotpotqatext0.7280.7530.1070.586
inspec/keyphraseslist0.4310.0330.0000.000
jnlpba/jnlpbalist0.7230.4740.5810.054
legallens-nerlist0.5650.1550.1650.038
linnaeuslist0.9640.5480.5000.000
medmentions/st21pvlist0.5170.4220.1370.003
mit-movie-trivialist0.7990.5530.5770.351
mit-restaurantlist0.7850.4270.3620.036
molwenitext0.6410.3690.1070.488
multidoc2dialtext0.6420.0100.0000.107
natural-questionstext0.7180.6570.1940.469
ncbi_disease/ncbi_diseaselist0.8430.5890.5600.075
ontonotes_english/SpeedOfMagic--ontonotes_englishlist0.8640.7840.5990.094
opinion-target/enlist0.7490.1020.0000.000
policyqatext0.4220.0520.0000.197
qaconvtext0.6780.6790.0950.620
qasper/spanslist0.0830.0340.0000.005
redocred/entitieslist0.7860.0000.0000.006
scierc/entitieslist0.4640.1720.1500.009
semeval2014/laptop-aspectslist0.8120.1320.0620.032
skillspan/knowledgelist0.7370.2780.0560.010
skillspan/skilllist0.4690.1460.0480.000
slurp/slotslist0.8280.6640.5440.250
squad-v2text0.7640.5850.5440.876
stackoverflow-nerlist0.7150.3730.3840.063
subjqa/bookstext0.7140.5660.6700.576
subjqa/electronicstext0.5590.3700.4800.332
subjqa/grocerytext0.6170.3130.5850.445
subjqa/moviestext0.6860.5300.6850.512
subjqa/tripadvisortext0.5220.3150.3940.422
swde/autotext0.6860.6230.5270.589
swde/booktext0.9910.9690.8750.570
swde/cameratext0.9970.7360.6300.682
swde/jobtext0.8520.7740.5190.513
swde/movietext0.7990.1740.2190.320
swde/nbaplayertext0.9720.9380.7780.540
swde/restauranttext0.9830.5010.7220.715
swde/universitytext0.9990.0320.0530.849
tab/piilist0.8600.3300.2880.000
timeqatext0.4620.1870.0000.102
toxic-spanslist0.5930.0000.0000.000
tweetner7list0.5560.4060.3940.093
ud/ewtlist0.8960.0170.0370.000
ud/gumlist0.8460.0390.0610.000
uner/en_ewtlist0.9240.7750.7620.198
wdc-pavetext0.9160.6990.7240.621
websrc/spanstext0.6940.1660.0000.491
wiesp2022-nerlist0.7220.4130.4290.029
wnut_17/wnut_17list0.5940.4750.5250.133

Training data

The extraction config gathers extractive QA (SQuAD 2.0, Natural Questions, HotpotQA, NewsQA, DuoRC, QuAC, CUAD, Qasper, TimeQA, WebSRC, SWDE, and others) and span tagging (CoNLL-2003, OntoNotes, Few-NERD, WNUT, CrossNER, biomedical, legal and financial NER, skills, aspects, keyphrases, and others), plus procedurally generated documents. A few sources (e.g. GUM, PreCo) are licensed for non-commercial use only; check the dataset card for per-source licenses.

Citation

@inproceedings{sileo-2024-tasksource,
    title = "tasksource: A Large Collection of {NLP} tasks with a Structured Dataset Preprocessing Framework",
    author = "Sileo, Damien",
    booktitle = "Proceedings of the 2024 Joint International Conference on Computational Linguistics, Language Resources and Evaluation (LREC-COLING 2024)",
    year = "2024",
    address = "Torino, Italia",
    pages = "15655--15684",
    url = "https://aclanthology.org/2024.lrec-main.1361",
}

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

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

GPU в ailist

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

Нельзя запустить

Модели нужен код из репозитория; автор пока не в списке доверенных организаций.

Класс архитектуры
UltrabertForTokenClassification
Ревизия весов
26bccb1

0 моделей