Instructions to use northlight-ai/keyphrase-extraction-multilingual-small with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use northlight-ai/keyphrase-extraction-multilingual-small with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("token-classification", model="northlight-ai/keyphrase-extraction-multilingual-small")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForTokenClassification tokenizer = AutoTokenizer.from_pretrained("northlight-ai/keyphrase-extraction-multilingual-small") model = AutoModelForTokenClassification.from_pretrained("northlight-ai/keyphrase-extraction-multilingual-small", device_map="auto") - Notebooks
- Google Colab
- Kaggle
keyphrase-extraction-multilingual-small: Zero-Teacher-Noise 8K Multilingual BIO Keyphrase Extractor
Built by Pankaj Garg at Northlight.
Try it in your browser: keyphrase-extraction-demo (runs 100% locally with transformers.js; first load ~270 MB).
An MIT-licensed, 141M-parameter, 8,192-token multilingual extractive keyphrase tagger fine-tuned from jhu-clsp/mmBERT-small exclusively on publisher/author-supplied verbatim keyphrases from commercial-use CC-BY and CC0 scholarly corpora (HAL Open Archive and DOAJ). Zero LLM teacher labels and zero model-generated OpenAlex keywords were used.
It uses the exact BIO label schema and ID ordering of yanekyuk/bert-uncased-keyword-extractor ({0: "O", 1: "B-KEY", 2: "I-KEY"}) and ships with both fp32 ONNX (onnx/model.onnx, 563.08 MB) and per-token-row uint8 embedding ONNX (onnx/model_quantized.onnx, 270.22 MB, dtype: "q8") for serverless browser inference.
One-line drop-in swap
from transformers import pipeline
# Before: pipeline("token-classification", model="yanekyuk/bert-uncased-keyword-extractor", aggregation_strategy="simple")
extractor = pipeline(
"token-classification",
model="northlight-ai/keyphrase-extraction-multilingual-small",
aggregation_strategy="simple",
)
text = "L'apprentissage profond amΓ©liore l'extraction de mots-clΓ©s multilingues sur des documents longs."
phrases = list(dict.fromkeys(ent["word"].strip() for ent in extractor(text)))
print(phrases)
Labels (config.id2label): 0: "O", 1: "B-KEY", 2: "I-KEY".
Use AutoTokenizer / AutoModelForTokenClassification. The architecture is ModernBERT (jhu-clsp/mmBERT-small, 8,192-token context; training used up to 1,024 tokens, and evaluation verified up to 2,048 tokens). Tested with transformers 5.20β5.22 and PyTorch 2.13β2.14. Note that @huggingface/transformers v3.8.1 in the browser ignores aggregation_strategy and returns per-token labels, so browser clients should pass { ignore_labels: [] } and group contiguous B-KEY/I-KEY tokens client-side (see space_static/bio_decode.js).
Headline benchmark results (Exact-Match Present-Keyphrase F1@M)
None of the 16 evaluation sets below was used for gradient training, hyperparameter tuning, or checkpoint/bias selection (zero exact-abstract, title, canonical print+online DOAJ journal, or 5-word-shingle Jaccard >= 0.50 overlap verified programmatically). The 12 external benchmarks were inspected once during the initial 8.4k-doc Stage-3 feasibility probe prior to scaling up to the final 32.7k-doc model, so they are excluded from training/selection rather than blind to the scale-up decision. Every model is decoded strictly with its own config.id2label ({0: O, 1: B-KEY, 2: I-KEY} for yanekyuk and ours; {0: B-KEY, 1: I-KEY, 2: O} for ml6team/kbir-inspec) using standard SIMPLE BIO span aggregation on exact tokenizer character offsets.
- Compared to
yanekyuk/bert-uncased-keyword-extractor(10,604 downloads/30d, Apache-2.0, EN-only, 512 tok): this model is better on all 16 of 16 evaluated benchmarks (zero regressions;+14.69onpapyrus_en,+29.77onpapyrus_fr,+21.76to+24.93on FR news/scholarly,+33.08to+41.67on canonical journal-disjoint ES/DE/IT/PT, and+5.08to+8.57on EN news/scientific sets). - Compared to
ml6team/keyphrase-extraction-kbir-inspec(5,313 downloads/30d, MIT, 355M RoBERTa-large whose fine-tuning corpus ismidas/inspec, EN-only, 512 tok): ahead on 13 of 16 benchmarks β every author-keyword, legal, and non-English benchmark (+16.06papyrus_en,+27.11papyrus_fr,+20.30to+23.29FR news/scholarly,+25.97to+33.80ES/DE/IT/PT,+1.40to+4.64europa_*) β whilekbir-inspecremains stronger on dense-annotation English-only sets (midas/inspectest split,semeval2017_en, andduc2001_en). Under Northlight's claim rule, we do not claim overall superiority overkbir-inspec. - Compared to French-only specialist
yanekyuk/camembert-keyword-extractor(MIT, FR-only, 512 tok): ahead on all 4 French benchmarks (+13.50papyrus_fr,+8.21wikinews_fr,+3.43europa_fr,+1.12termith_fr).
1. External author-keyword & classic human benchmarks
Paired 95% confidence intervals use 2,000 document-level bootstrap resamples (seed 42).
| Dataset | Lang | Domain / Source | n | yanekyuk (EN 512) |
kbir-inspec (EN 512) |
camembert (FR 512) |
This model (2048) | Ξ vs yanekyuk (95% CI) |
Ξ vs kbir-inspec (95% CI) |
|---|---|---|---|---|---|---|---|---|---|
NCube/papyrus (papyrus-e test) |
en | Author keywords (Apache-2.0) | 2,967 | 18.97 | 17.60 | β | 33.66 | +14.69 [+13.84, +15.55] |
+16.06 [+15.26, +16.86] |
NCube/papyrus (papyrus-f test) |
fr | Author keywords (Apache-2.0) | 2,919 | 5.17 | 7.83 | 21.44 | 34.94 | +29.77 [+28.90, +30.67] |
+27.11 [+26.29, +27.94] |
taln-ls2n/wikinews-fr-100 test |
fr | News (human, eval-only) | 100 | 13.60 | 12.07 | 27.14 | 35.36 | +21.76 [+18.27, +25.43] |
+23.29 [+20.00, +26.72] |
taln-ls2n/termith-eval test |
fr | Scholarly (human, eval-only) | 379 | 6.62 | 11.25 | 30.43 | 31.55 | +24.93 [+22.42, +27.41] |
+20.30 [+17.87, +22.65] |
midas/duc2001 test |
en | News (dense human, eval-only) | 308 | 12.62 | 24.69 | β | 17.70 | +5.08 [+3.21, +6.86] |
β6.99 [β9.18, β4.78] |
midas/inspec test split |
en | Scientific (dense; kbir fine-tuning corpus) | 496 | 15.34 | 56.91 | β | 23.91 | +8.57 [+6.27, +10.59] |
β33.01 [β35.63, β30.62] |
midas/semeval2017 test |
en | ScienceIE (dense, 12.2 KPs/doc) | 100 | 15.56 | 41.75 | β | 21.74 | +6.18 [+2.75, +9.73] |
β20.00 [β24.50, β15.39] |
(At matched 512-token context, this model scores 33.38 on papyrus_en and 34.17 on papyrus_fr.)
2. External long-document legal benchmark (NCube/europa test, MIT)
NCube/europa contains multi-page EU Court of Justice judgments (median 5,188β6,448 words) labelled with EuroVoc controlled legal descriptors (including multi-clause statutory references). Exact-match F1@M is bounded below 7 for all extractors on this domain, and native 2,048-token inference improves over both 512-token truncation and sliding-window chunking.
| Language | n | yanekyuk (512 / chunked) |
kbir-inspec (512 / chunked) |
This model (512 / 2048) | Ξ vs yanekyuk 512 (95% CI) |
Ξ vs kbir-inspec 512 (95% CI) |
|---|---|---|---|---|---|---|
europa_en |
1,524 | 1.99 / 1.76 | 4.73 / 2.83 | 4.66 / 6.13 | +4.14 [+3.62, +4.69] |
+1.40 [+0.90, +1.90] |
europa_fr |
1,556 | 0.02 / 0.12 | 0.68 / 0.66 | 4.34 / 4.91 | +4.89 [+4.41, +5.36] |
+4.23 [+3.76, +4.71] |
europa_es |
1,555 | 0.00 / 0.01 | 0.59 / 0.66 | 4.73 / 5.23 | +5.23 [+4.80, +5.69] |
+4.64 [+4.21, +5.09] |
europa_de |
1,558 | 0.01 / 0.09 | 2.54 / 1.12 | 4.71 / 5.15 | +5.14 [+4.66, +5.63] |
+2.61 [+2.06, +3.16] |
europa_it |
1,569 | 0.00 / 0.03 | 0.53 / 0.61 | 3.50 / 4.27 | +4.27 [+3.89, +4.68] |
+3.74 [+3.31, +4.17] |
3. Canonical journal-disjoint held-out DOAJ CC-BY author-keyword benchmarks (ES, DE, IT, PT)
Each set comprises 12β15 canonical strict CC-BY/CC0 journals (print + online ISSNs unified via union-find on doaj.org/csv) held out globally from all training and dev splits (zero canonical journal overlap and zero 5-word-shingle Jaccard >= 0.50 overlap across any language). Note that these come from the same DOAJ domain as part of the training corpus; intervals are canonical journal-cluster-level paired bootstraps (2,000 resamples).
| Language | n (canonical journals) | yanekyuk (EN 512) |
kbir-inspec (EN 512) |
This model | Ξ vs yanekyuk (journal-cluster 95% CI) |
Ξ vs kbir-inspec (journal-cluster 95% CI) |
|---|---|---|---|---|---|---|
doaj_es |
536 (15) | 3.94 | 15.49 | 41.69 | +37.75 [+33.94, +41.02] |
+26.19 [+24.62, +28.07] |
doaj_de |
250 (13) | 9.06 | 14.41 | 43.99 | +34.93 [+32.65, +38.28] |
+29.58 [+25.35, +32.21] |
doaj_it |
187 (15) | 7.95 | 15.06 | 41.03 | +33.08 [+22.59, +39.87] |
+25.97 [+19.63, +30.83] |
doaj_pt |
565 (12) | 3.05 | 10.93 | 44.72 | +41.67 [+36.23, +47.64] |
+33.80 [+27.78, +40.25] |
Training procedure
- Data: 32,652 training documents + 1,730 canonical-journal & shingle-disjoint internal dev documents across 6 languages (EN 11,518; FR 8,950; ES 5,820; PT 4,647; DE 1,149; IT 568), harvested exclusively from commercial-use CC-BY/CC0 HAL Open Archive and DOAJ articles with
>= 2verbatim author-supplied present keyphrases. - Objective: Positive-unlabeled / negative-downweighted cross-entropy (
w_O = 0.25,w_{B-KEY} = w_{I-KEY} = 1.0) so unannotated valid phrases in sparse author keyword lists do not over-penalize recall, using an exact normalized-to-source Unicode offset map for span alignment. - Calibration folded into weights: Checkpoint selected at Epoch 3 on internal dev (dev F1@M
39.62), and the single dev-optimal scalarO-class logit bias (+0.20) was folded directly intoclassifier.bias[0](verified to0.000000max fp32 logit diff) so standard out-of-the-boxargmax/TokenClassificationPipeline(aggregation_strategy="simple")requires zero custom post-processing. - Compute: Single AMD Radeon AI PRO R9700 (32 GB VRAM, ROCm), bf16 mixed precision, lr
4e-5, cosine schedule, effective batch size 32, ~13.6 minutes total for 3 epochs.
ONNX export & CPU parity
To avoid the scalar quantization error of generic ONNX Gather quantization across 256,000 vocabulary rows, onnx/model_quantized.onnx quantizes tok_embeddings.weight per-token-row to uint8 (Gather -> Cast -> Mul(row_scale) -> Add(row_min)), using standard ONNX opset 18 ops. Both fp32 and q8 exports pass token agreement (>= 99%) and F1@M drift (<= 0.20 pts) gates against PyTorch fp32 on 128 EN + 128 FR held-out documents (papyrus_en and papyrus_fr):
| Format | File | Size | EN token agree (n=128) | FR token agree (n=128) | EN F1@M (drift) | FR F1@M (drift) |
|---|---|---|---|---|---|---|
| PyTorch fp32 | model.safetensors |
562.58 MB | ref | ref | 31.99 (ref) | 32.63 (ref) |
| ONNX fp32 | onnx/model.onnx |
563.08 MB | 100.000% | 100.000% | 31.99 (0.00) |
32.63 (0.00) |
ONNX per-row uint8 (q8) |
onnx/model_quantized.onnx |
270.22 MB | 99.945% | 99.958% | 32.09 (0.10) |
32.51 (0.12) |
Limitations
- Extractive present keyphrases only: As a BIO token tagger, this model only extracts phrases occurring verbatim in the input text; it does not generate absent keyphrases.
- Dense-annotation English benchmarks: Trained on sparse author-supplied keyword lists (
3.1 present phrases/doc), the model predicts ~4β6 keyphrases per abstract. On densely annotated English benchmarks (7β12 spans/doc such asmidas/inspectest split ormidas/semeval2017),ml6team/keyphrase-extraction-kbir-inspec(whose fine-tuning corpus ismidas/inspec) extracts more spans and scores higher. - Language coverage: Fine-tuning focused on 6 Latin-script European languages (EN, FR, ES, DE, IT, PT). Non-Latin languages supported by
mmBERT-smallwere not directly fine-tuned or benchmarked here. - Legal/controlled-vocabulary domains: Exact-match scores on
NCube/europareflect EuroVoc controlled descriptors (including long statutory clauses) rather than free author keywords.
Citation
@misc{garg2026keyphrasemultilingual,
author = {Garg, Pankaj},
title = {keyphrase-extraction-multilingual-small: A Zero-Teacher-Noise 8K Multilingual BIO Keyphrase Extractor},
year = {2026},
publisher = {Hugging Face},
howpublished = {\url{https://huggingface.co/northlight-ai/keyphrase-extraction-multilingual-small}}
}
- Downloads last month
- 25
Model tree for northlight-ai/keyphrase-extraction-multilingual-small
Base model
jhu-clsp/mmBERT-smallSpace using northlight-ai/keyphrase-extraction-multilingual-small 1
Evaluation results
- Exact-Match Present F1@M on papyrus-e (EN human author keyphrases)test set self-reported33.660
- Exact-Match Present F1@M on papyrus-f (FR human author keyphrases)test set self-reported34.940
- Exact-Match Present F1@M on WikiNews-FR (FR news)test set self-reported35.360
- Exact-Match Present F1@M on TermITH (FR scholarly)test set self-reported31.550
- Exact-Match Present F1@M on DUC-2001 (EN news)test set self-reported17.700
- Exact-Match Present F1@M on Inspec (EN scientific)test set self-reported23.910