Mindket

UltraBERT-150M-clairic-extraction

Newversion 1 · updated

Overview

Pulls answers out of a text for fields you describe in short instructions, such as invoice numbers or company names, and returns the matching spans. One 150M model covers extractive QA and entity recognition.

UltraBERT-150M-clairic-extraction is a kit in the Developer category, listed by Mindket. It is free. This is version 1, last updated on . Download it on this page, a zip of its files. Nothing in it runs by itself.

At a glance

You need
  • Python and pip
  • PyTorch and the transformers library
  • Willingness to run code shipped in the repository, because the UltraBERT architecture needs trust_remote_code set to True
  • Optional: onnxruntime and huggingface_hub for the ONNX file
Runs in
  • Python scripts with the transformers library
  • A browser, through the card's int8 ONNX file and onnxruntime-web, as in its demo space
  • Python with onnxruntime, using the same ONNX file
  • Windows, macOS or Linux with Python, for downloading the files
Start with
pip install -U huggingface_hub
hf download tasksource/UltraBERT-150M-clairic-extraction

Platform

WindowsOperating system
macOSOperating system
LinuxOperating system

About

What it is

UltraBERT-150M-clairic-extraction is a 150M-parameter extractor built on UltraBERT-150M. Send it one text plus a list of fields, where every field has a brief instruction, and it gives back the stretches of text that answer each one. A field can come back with one answer, a list, or nothing.

A field may be a question or the kind of entity you want, which lets one model do extractive QA as well as entity tagging. It tags the answer tokens in the text as B, I or O, guided by the instruction, and handles inputs up to 2048 tokens.

Who it suits

Developers who need structured data out of English text, such as invoices or notes, without running a language model that writes free text. It suits NLP researchers who want to try instruction-guided span tagging.

IndustryWho uses itHow they use itExample
Finance and adminBack-office teamsPull invoice numbers and totals out of textAsk for the total amount due
SoftwareDevelopersReplace separate QA and entity models with oneAsk for every company named in a text
ResearchNLP researchersStudy instruction-guided span taggingTest it on your own labeled texts

People who need generated summaries or rewritten text can skip it, since it only returns spans taken from the source text.

Where to use it

  • Python scripts with the transformers library
  • A browser, through the card's int8 ONNX file and onnxruntime-web, as in its demo space
  • Python with onnxruntime, using the same ONNX file
  • Windows, macOS or Linux with Python, for downloading the files
Use caseWhoWhat they get back
Field extraction from documentsDevelopersA list of matching spans for each field
Question answering over a textAnalystsThe span that answers each question, or an empty list
Entity listingNLP teamsEvery entity of a type you describe, as written

How to set it up

You need Python with PyTorch and transformers.

  • Python and pip
  • PyTorch and the transformers library
  • Willingness to run code shipped in the repository, because the UltraBERT architecture needs trust_remote_code set to True
  • Optional: onnxruntime and huggingface_hub for the ONNX file
  1. Install the huggingface_hub package.
  2. Download the model files with the hf command.
  3. Load the tokenizer and the model with transformers.
  4. Call the extract function from the card with your text and fields.
pip install -U huggingface_hub
hf download tasksource/UltraBERT-150M-clairic-extraction

How to use it

You pass a text and a dictionary that maps each field name to an instruction. The instruction can be a question or an entity type. The card's helper function turns the model's tags into spans.

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': []}

The card also ships an int8 ONNX export that is 204 MB against 604 MB in fp32. Its inputs are input_ids and attention_mask, and its output is logits for the O, B and I tags. Build its input as the endoftext token, the instruction, the sep token, then the text.

ToolWhat it does
extractThe card's helper that turns the model's tags into spans for each field
AutoModelForTokenClassificationLoads the extractor, with trust_remote_code set to True
onnx/model_quantized.onnxThe int8 export for onnxruntime in Python or in a browser

Example

You pass a sentence about an invoice and ask for the invoice number, every company named, the total due and a phone number. It returns the spans it found for each field. The phone field comes back as an empty list when the text holds no number.

For newcomers and experts

Think of it as a highlighter that follows instructions. You tell it what to look for, and it marks the matching words in your text. A good first try is the sample script above with your own short text.

Underneath, it is UltraBERT-150M trained on the extraction part of a typed-decisions dataset, where question-answering and span-tagging data was rewritten as instruction, text and span triples. The ONNX file quantizes linear weights to 8 bits per block of 32, and plain dynamic int8 breaks the model, so use the card's file.

  1. Give a text and fields with instructions
  2. Pair each instruction with the text
  3. The model tags answer tokens as B, I or O
  4. Spans are read off the text tokens

Good to know

The card compares the ONNX file with PyTorch on a small evaluation of 20 rows per source. The tags match on 99.6% of tokens.

F1 on the card's evaluation
QA F1, ONNX int80.730
QA F1, PyTorch fp160.728
List F1, ONNX int80.701
List F1, PyTorch fp160.700
  • Naming: the card says it is not affiliated with Cloudflare, and Clairic-style only names the request format
  • Size: 151M parameters in Safetensors, with a 204 MB ONNX file
  • Language: English is the one listed
  • License: Apache 2.0
  • Cost to run: no API key or paid service is named
  • Data it reaches: the text you pass in, which stays on your machine, plus the model files you download from Hugging Face
  • Not for: generating new text, since it only returns spans from the input, and inputs longer than 2048 tokens

README and files

README

UltraBERT-150M-clairic-extraction

Pulls answers out of a text for fields you describe in short instructions, such as invoice numbers or company names, and returns the matching spans. One 150M model covers extractive QA and entity recognition.

Made by tasksource on Hugging Face. These notes are Mindket's, written from its model page and model card; the model's own files and license are on Hugging Face.

About

What it is: UltraBERT-150M-clairic-extraction is a 150M-parameter extractor built on UltraBERT-150M. Send it one text plus a list of fields, where every field has a brief instruction, and it gives back the stretches of text that answer each one. A field can come back with one answer, a list, or nothing.

A field may be a question or the kind of entity you want, which lets one model do extractive QA as well as entity tagging. It tags the answer tokens in the text as B, I or O, guided by the instruction, and handles inputs up to 2048 tokens.

Who it suits: Developers who need structured data out of English text, such as invoices or notes, without running a language model that writes free text. It suits NLP researchers who want to try instruction-guided span tagging.

Industry | Who uses it | How they use it | Example
Finance and admin | Back-office teams | Pull invoice numbers and totals out of text | Ask for the total amount due
Software | Developers | Replace separate QA and entity models with one | Ask for every company named in a text
Research | NLP researchers | Study instruction-guided span tagging | Test it on your own labeled texts

People who need generated summaries or rewritten text can skip it, since it only returns spans taken from the source text.

Where to use it:

  • Python scripts with the transformers library
  • A browser, through the card's int8 ONNX file and onnxruntime-web, as in its demo space
  • Python with onnxruntime, using the same ONNX file
  • Windows, macOS or Linux with Python, for downloading the files
Use case | Who | What they get back
Field extraction from documents | Developers | A list of matching spans for each field
Question answering over a text | Analysts | The span that answers each question, or an empty list
Entity listing | NLP teams | Every entity of a type you describe, as written

How to set it up: You need Python with PyTorch and transformers.

  • Python and pip
  • PyTorch and the transformers library
  • Willingness to run code shipped in the repository, because the UltraBERT architecture needs trust_remote_code set to True
  • Optional: onnxruntime and huggingface_hub for the ONNX file
  1. Install the huggingface_hub package.
  2. Download the model files with the hf command.
  3. Load the tokenizer and the model with transformers.
  4. Call the extract function from the card with your text and fields.
pip install -U huggingface_hub
hf download tasksource/UltraBERT-150M-clairic-extraction

How to use it: You pass a text and a dictionary that maps each field name to an instruction. The instruction can be a question or an entity type. The card's helper function turns the model's tags into spans.

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': []}

The card also ships an int8 ONNX export that is 204 MB against 604 MB in fp32. Its inputs are input_ids and attention_mask, and its output is logits for the O, B and I tags. Build its input as the endoftext token, the instruction, the sep token, then the text.

Tool | What it does
extract | The card's helper that turns the model's tags into spans for each field
AutoModelForTokenClassification | Loads the extractor, with trust_remote_code set to True
onnx/model_quantized.onnx | The int8 export for onnxruntime in Python or in a browser

Example: You pass a sentence about an invoice and ask for the invoice number, every company named, the total due and a phone number. It returns the spans it found for each field. The phone field comes back as an empty list when the text holds no number.

For newcomers and experts: Think of it as a highlighter that follows instructions. You tell it what to look for, and it marks the matching words in your text. A good first try is the sample script above with your own short text.

Underneath, it is UltraBERT-150M trained on the extraction part of a typed-decisions dataset, where question-answering and span-tagging data was rewritten as instruction, text and span triples. The ONNX file quantizes linear weights to 8 bits per block of 32, and plain dynamic int8 breaks the model, so use the card's file.

Give a text and fields with instructions
Pair each instruction with the text
The model tags answer tokens as B, I or O
Spans are read off the text tokens

Good to know: The card compares the ONNX file with PyTorch on a small evaluation of 20 rows per source. The tags match on 99.6% of tokens.

Title: F1 on the card's evaluation
QA F1, ONNX int8: 0.730
QA F1, PyTorch fp16: 0.728
List F1, ONNX int8: 0.701
List F1, PyTorch fp16: 0.700
  • Naming: the card says it is not affiliated with Cloudflare, and Clairic-style only names the request format
  • Size: 151M parameters in Safetensors, with a 204 MB ONNX file
  • Language: English is the one listed
  • License: Apache 2.0
  • Cost to run: no API key or paid service is named
  • Data it reaches: the text you pass in, which stays on your machine, plus the model files you download from Hugging Face
  • Not for: generating new text, since it only returns spans from the input, and inputs longer than 2048 tokens

On Hugging Face, 13 November 2026

  • Task: token classification
  • Library: transformers
  • Parameters: 151M
  • Weights: about 604 MB in F32; about 76 MB at 4-bit (estimate)
  • Formats: Safetensors
  • Downloads in the last 30 days: 138
  • Likes: 5
  • License: apache-2.0
  • Languages: en
  • Based on: dmis-lab/UltraBERT-150M
  • Tags: transformers, onnx, safetensors, ultrabert, token-classification, information-extraction, extractive-qa, span-extraction, tasksource

Links

Get the model

Download its files with Hugging Face's command line:

pip install -U huggingface_hub
hf download tasksource/UltraBERT-150M-clairic-extraction

Then follow the usage in its model card. Nothing in this kit runs by itself.

Files
README.md  8 KB

1 file, 8 KB, downloaded as a zip.

What’s new

  • Version 1 · 2026-11-13

Compare with similar

Listed Hugging Face models in the same category that share the most tags with this one.

ProductDownloads, last 30 daysLikesParametersLicenseLast change
UltraBERT-150M-clairic-extraction This page1385151Mapache-2.0
bert-base-NERShares token-classification · onnx · transformers1,038,928750108Mmit
OpenAI Privacy FilterShares token-classification · onnx · transformers102,9111,8311.4Bapache-2.0
cbx-indic-pii-extractor-58MShares token-classification · onnx · safetensors96457.6Mapache-2.0
cbx-indic-pii-extractor-17MShares token-classification · onnx · safetensors76316.7Mapache-2.0
AstrLink GuardShares token-classification · onnx40829—apache-2.0
Numbers as Mindket last read them, on 2026-11-13.

Reviews

No ratings yet

Write a review

No reviews yet.

More from Mindket

See all from Mindket

buzz

block · Kit

Self-hostable workspace where people and AI agents share the same rooms, built on a Nostr relay that logs every action as a signed event. For teams that want t…

New37.3k

plannotator

backnotprop · Kit

Opens your AI coding agent's plans, specs and code changes in a browser so you can annotate or comment on them and send the feedback straight back to the agent.

New10.5k

open-code-review

alibaba · Kit

Reviews Git changes with an AI agent that reads files and searches the codebase, then writes comments tied to exact lines. It suits developers who want automat…

New50.7k

Similar in Developer

See all in Developer

VibeVoice-1.5B

microsoft · Kit

Turns written conversations into spoken audio with up to four speakers and about 90 minutes of speech, an open Microsoft text-to-speech model for research on p…

New

voicetut-egyptian-tashkeel

masterofaudio2077 · Kit

Reads Egyptian Arabic text aloud and follows the short vowel marks you write into it. A fine-tune of VoiceTut-TTS that keeps its 19 built-in voices and voice c…

New

Runs Meta's Llama 3.1 8B Instruct chat model in 4-bit AWQ form, so it fits on a GPU with about 4 GiB of free memory for the weights. For developers who want a…

New