/ Модель

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

Контекст
8 192 токена
Параметры
149 млн
Лицензия
Apache 2.0
Архитектура
modernbert · dense
Базовая модель
ModernBERT-base
Опубликована
10 авг 2026

semantic-chunker-modernbert-base

Разметка токеновТекст → label6 профессий

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

370скачиваний за 30 дней1лайквеса обновлены10 авг 2026

Бенчмарки

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

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

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

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

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

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

0xKitkat/semantic-chunker-modernbert-base — англоязычная модель 0xKitkat для семантического разбиения документов на фрагменты в RAG-пайплайнах. Это дообученная на структуре разделов Wikipedia модель ModernBERT-base с архитектурой token classification и 149 млн параметров. Она оценивает вероятность границы темы после каждого предложения; контекст модели — до 8192 токенов, обучение проводилось с контекстом 2048 токенов. Доступны веса в форматах Safetensors и ONNX.

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

Модель обучена на англоязычном энциклопедическом тексте; разговорные расшифровки, код и таблицы отличаются от обучающего распределения. Для коротких документов семантическое разбиение может ухудшить поиск и работать существенно медленнее фиксированного разделителя. Лицензия — Apache-2.0.

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

  • семантическое разбиение длинных статей для RAG
  • поиск тематических границ в отчётах и руководствах
  • разделение длинных транскриптов на фрагменты по смене темы
  • подготовка фрагментов документов для последующей индексации и поиска

Ограничения

Модель ориентирована на английскую энциклопедическую прозу; разговорные транскрипты, код и таблицы могут быть вне обучающего распределения. Более точное определение границ не гарантирует улучшения поиска, а обработка может быть в 10–100 раз медленнее фиксированного разбиения.

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

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

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

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

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

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

Открыть на Hugging Face

Semantic chunker (ModernBERT-base)

Predicts, for each sentence, whether a topic boundary follows it. Intended as a drop-in chunker for RAG pipelines.

What is different here

  • 2048-token training context. The closest existing model trains at 1024. Median Wikipedia article is ~980 tokens, so 2048 keeps ~82% of documents in a single window instead of ~53%.
  • Supervision at sentence-final tokens only. Labelling every token puts the positive rate near 1% and the model collapses toward never predicting a split. Scoring only sentence-final positions raises it to ~12%.
  • Trained on Wikipedia section structure, not book paragraphing.

Results

Both models are ModernBERT-base token taggers sharing a tokenizer, so they are scored at identical positions: P(boundary) read at each sentence's final token. Threshold swept 0.05–0.95; the best operating point is reported.

wiki727k test — in-distribution for this model

ModelF1PrecisionRecallThreshold
this model0.81560.83900.79340.70
mirth/chonky_modernbert_base_10.49860.45430.55240.90
baseline:every-k (best k, oracle-tuned) (k=2)0.19840.12280.5159—
baseline:base-rate random0.11770.11660.1187—

PubMed-RCT — out-of-distribution for both models

Non-Wikipedia scientific prose with human-assigned section labels. Boundary rate is 35.2% here versus ~11.7% on Wikipedia, so scores are not comparable across the two tables — only across models within one table.

ModelF1PrecisionRecallThreshold
this model0.69320.72930.66050.55
mirth/chonky_modernbert_base_10.50240.50950.49540.85
baseline:every-k (best k, oracle-tuned) (k=2)0.40340.35000.4759—
baseline:base-rate random0.34900.35210.3460—

Retrieval — does better boundary detection actually help?

Macro-average over 3 corpora (gov_report, qmsum, stackoverflow), embedder BAAI/bge-small-en-v1.5, identical 512-token cap on every strategy so chunk size cannot confound the comparison.

StrategynDCG@10R@1R@5R@10mean chunk tokens
fixed-512-ovl640.86250.82540.92180.9500388
chonky-min2560.86150.79950.93530.9635274
ours-min256 (this model)0.85830.79140.93280.9659283
ours (this model)0.85750.78540.93210.9685215
sentence-80.85360.79560.92670.9536182
fixed-5120.85310.80190.92790.9512385
recursive-5120.85280.79030.92180.9598308
chonky0.84980.77020.93210.9684146

Per corpus (nDCG@10):

Strategygov_reportqmsumstackoverflow
fixed-512-ovl640.94230.69880.9464
chonky-min2560.92850.70990.9461
ours-min2560.92250.70560.9467
ours0.91910.72540.9280
sentence-80.92720.68650.9472
fixed-5120.93480.67820.9463
recursive-5120.92140.69100.9459
chonky0.90460.71180.9329

Reading these numbers honestly

baseline:every-k splits every k sentences with k chosen to maximise its own score — a model-free floor with oracle tuning in its favour. The wiki727k comparison flatters this model: Wikipedia section boundaries are its training distribution and are out-of-distribution for chonky, which trained on BookCorpus paragraphs. The PubMed table is the fair comparison.

Better boundaries did not produce a uniform retrieval win, and the retrieval table above should be read before adopting this. That result is consistent with the published critique of semantic chunking, and it is reported here rather than omitted. Boundary F1 and retrieval quality are different things; this model is much better at the first and situationally better at the second.

When this helps, and when it does not

Use it for long documents whose topic genuinely shifts partway through — transcripts, reports, articles, manuals. That is where fixed-size splitting cuts through the middle of an idea and where boundary detection pays.

Do not use it for corpora whose documents are already shorter than your embedder's window. Splitting a 150-token document into two 75-token fragments makes retrieval worse, not better, no matter how correct the boundary is. On such corpora fixed-size chunking is competitive, faster, and has no dependencies — use that instead.

min_chunk_tokens is a corpus-dependent knob, not a default. Setting it to 256 recovered most of the short-document deficit (+0.019 nDCG@10 on stackoverflow) but cost almost exactly as much on long transcripts (−0.020 on qmsum), by merging away the boundaries that made the model useful there. Set it high for short documents, leave it at 0 for long ones, and measure on your own corpus rather than trusting either default.

Cost. Chunking with this model is roughly one to two orders of magnitude slower than a fixed-size splitter (per-strategy wall time is recorded in retrieval_eval.json). On corpora where it does not win, that cost buys nothing.

Usage

Nothing to download by hand in any of these — the weights resolve from this repo on first use.

With transformers alone

The custom pipeline is registered in this repo's config, so this needs no install beyond transformers:

from transformers import pipeline

chunk = pipeline("semantic-chunking", model="0xKitkat/semantic-chunker-modernbert-base",
                 trust_remote_code=True)

for c in chunk(document_text):
    print(c["n_tokens"], c["boundary_score"], c["text"][:80])

Pass return_text=True for plain strings, or any of threshold, max_chunk_tokens, min_chunk_tokens to tune it.

With the pip package

pip install "boundary-chunker[onnx]"    # CPU, no torch
pip install "boundary-chunker[torch]"   # GPU
from boundary_chunker import SemanticChunker

chunker = SemanticChunker(backend="onnx")     # or backend="torch"
for c in chunker.split(document_text):
    print(c.n_tokens, c.text[:80])

There is a CLI too:

boundary-chunk --backend onnx --file report.txt --json

Straight from this repo, no install

hf download 0xKitkat/semantic-chunker-modernbert-base chunk.py --local-dir .
from chunk import SemanticChunker

chunker = SemanticChunker(threshold=0.5, max_chunk_tokens=512)

max_chunk_tokens force-splits over-long chunks at the model's lowest-confidence interior boundary rather than at an arbitrary offset.

CPU-only, without torch

An ONNX export lives in onnx/ and needs onnxruntime instead of the full torch stack — roughly 40MB of dependencies rather than a CUDA install. It is self-contained, with its own config and tokenizer beside the graph, and backend="onnx" fetches it for you.

The export is verified against the torch model on held-out wiki727k documents: identical chunk boundaries on 24/24 documents (739–65,468 chars, including multi-window ones), and max |P(boundary) delta| 8.1e-06 on padded batches. The pipeline is likewise checked against the direct API — identical boundaries on 12/12 documents — so all three entry points above give the same answer. Both checks are reproducible with onnx_parity.py in the training repo.

Training

Baseanswerdotai/ModernBERT-base (149M)
Datawiki727k, 582,160 train docs / 30,580,099 sentences
Boundary rate11.7%
Max length2048
Effective batch32
LR / schedule3e-5, linear, 6% warmup
Epochs1
Lossclass-weighted CE (positive weight 3.0)
Hardware1x RTX 4070 SUPER (12GB)

Section titles are dropped from the training text: with headings present the task partly degenerates into "a heading follows", which does not transfer to the unformatted prose a chunker sees in production.

Limitations

  • English only.
  • Trained on encyclopedic prose; conversational transcripts, code, and tabular documents are out of distribution.
  • Boundary F1 is a proxy. If your goal is retrieval quality, measure retrieval.

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

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

GPU в ailist

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

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

Подбираем GPU…

Класс архитектуры
ModernBertForTokenClassification
Ревизия весов
2ef9bc2

0 моделей