Prompt Compressor (mBERT): multilingual, Apache-2.0, LLMLingua-2 drop-in

Scores each word of a prompt with a keep probability so the least informative words can be cut before an LLM call. Drop-in replacement for microsoft/llmlingua-2-bert-base-multilingual-cased-meetingbank: same architecture, speed and llmlingua API, different training data.

Microsoft LLMLingua-2 (mBERT) This model
Training text English meeting transcripts (MeetingBank) 18 languages; web, encyclopedia, meetings, multi-turn chat
Training-data license cc-by-nc-sa-4.0 (MeetingBank-LLMCompressed) ODC-BY, CC-BY-SA, CC-BY, MIT, OGL and Apache-2.0 sources; license recorded per row
Label teacher GPT-4 google/gemma-4-26B-A4B-it (Apache-2.0; 4-bit AWQ weights), LLMLingua-2 word-deletion protocol with an explicit length budget
Model license Apache-2.0 Apache-2.0

Results at a glance

With Qwen/Qwen3.5-9B answering (a different family from the label teacher), this model is close to microsoft/llmlingua-2-bert-base-multilingual-cased-meetingbank but not better overall:

Qwen3.5-9B answering English LongBench Chinese LongBench TyDi-RAG, 9 languages (F1)
2x, this model vs Microsoft mBERT 49.6 vs 50.0 43.5 vs 41.7 61.8 vs 65.2
3x, this model vs Microsoft mBERT 43.2 vs 46.5 37.9 vs 36.9 51.6 vs 53.2

The stronger sibling is Cis-Labs/prompt-compressor-xlm-roberta-large (560M params, same labels, drop-in for microsoft/llmlingua-2-xlm-roberta-large-meetingbank; best on 9-language TyDi-RAG and Chinese at 3x). This one is the small 178M encoder: CPU serving, the 178 MB int8 ONNX export, and in-browser compression.

Quick start

# pip install llmlingua
from llmlingua import PromptCompressor

compressor = PromptCompressor(model_name="Cis-Labs/prompt-compressor-bert-base-multilingual-cased", use_llmlingua2=True, device_map="cpu")
out = compressor.compress_prompt(long_context, rate=0.5, force_tokens=["\n", "?"])
print(out["compressed_prompt"], out["rate"])

llmlingua (≤0.2.2) picks its word-merging rule from the model name, so the repo id contains bert-base-multilingual-cased.

Evaluation

Downstream QA on the compressed context (greedy decoding, higher is better), every method run through llmlingua on the same context. Answering models: Qwen/Qwen3.5-9B and google/gemma-4-12B-it (the teacher's family). LongBench: 9 tasks, 60 seeded samples each, middle-truncated to 6k words. TyDi-RAG: TyDi QA GoldP validation in 9 languages, 50 questions each, 7 same-language distractor passages per question. Training data was decontaminated against all eval contexts.

Answering model: Qwen/Qwen3.5-9B

2x compression (rate 0.5)

Method LongBench EN (7 tasks) LongBench ZH (2 tasks) TyDi-RAG, 9 languages (F1) TyDi-RAG answer hit-rate
No compression (reference) 54.0 49.1 76.4 78.9
Random word drop 42.4 43.0 41.4 28.9
LLMLingua-2 mBERT (Microsoft) 50.0 41.7 65.2 58.0
LLMLingua-2 XLM-R-large (Microsoft) 51.3 37.3 69.3 61.3
This model 49.6 43.5 61.8 56.0
prompt-compressor-xlm-roberta-large 51.1 42.9 67.3 60.9

3x compression (rate 0.33)

Method LongBench EN (7 tasks) LongBench ZH (2 tasks) TyDi-RAG, 9 languages (F1) TyDi-RAG answer hit-rate
No compression (reference) 54.0 49.1 76.4 78.9
Random word drop 40.0 38.6 28.6 16.0
LLMLingua-2 mBERT (Microsoft) 46.5 36.9 53.2 45.8
LLMLingua-2 XLM-R-large (Microsoft) 47.4 32.9 55.9 45.6
This model 43.2 37.9 51.6 44.2
prompt-compressor-xlm-roberta-large 46.1 40.1 59.1 52.7
Per-task scores
Task Random @0.5 Random @0.33 MS mBERT @0.5 MS mBERT @0.33 MS XLM-R @0.5 MS XLM-R @0.33 This model (mBERT) @0.5 This model (mBERT) @0.33 Cis Labs XLM-R-large @0.5 Cis Labs XLM-R-large @0.33 No compression
multifieldqa_en 31.1 27.6 48.4 41.9 49.1 41.2 50.0 33.1 53.3 46.1 57.1
qasper 43.9 36.0 54.4 48.1 53.1 45.7 49.6 48.0 51.6 48.6 51.8
hotpotqa 48.5 48.5 57.4 54.8 65.1 60.4 60.4 49.7 62.2 57.9 61.5
2wikimqa 40.9 39.5 53.9 46.2 52.7 46.9 47.4 38.6 52.1 34.3 61.8
musique 24.6 21.7 28.7 25.6 30.9 29.6 32.0 25.2 30.4 29.0 34.0
qmsum 18.9 18.2 20.1 19.6 19.4 19.2 19.2 19.4 19.4 20.0 21.4
triviaqa 89.0 88.4 87.3 89.1 89.0 88.8 88.8 88.8 89.0 87.2 90.6
multifieldqa_zh 62.8 56.6 61.9 53.5 51.5 45.1 63.1 54.0 60.4 55.8 73.7
dureader 23.3 20.5 21.5 20.3 23.1 20.7 23.9 21.8 25.4 24.5 24.6
tydi_arabic 42.5 31.8 64.7 58.0 62.4 49.9 62.5 53.4 63.4 58.4 75.6
tydi_bengali 36.7 25.4 62.7 55.1 78.2 54.6 61.8 50.1 72.9 63.0 81.3
tydi_english 52.4 26.5 73.0 63.8 80.2 68.5 72.3 66.4 77.9 67.5 85.0
tydi_finnish 43.9 28.6 66.0 53.9 72.2 60.6 62.5 45.2 69.0 56.6 73.3
tydi_indonesian 46.8 28.5 72.1 56.3 70.8 62.3 71.7 58.6 73.3 64.1 83.6
tydi_korean 37.8 24.6 57.2 44.4 56.1 40.6 55.9 51.0 57.0 52.5 64.1
tydi_russian 39.6 30.7 63.9 50.9 72.7 60.7 48.0 45.9 54.4 46.5 71.9
tydi_swahili 51.5 33.5 61.9 53.9 66.8 53.9 55.4 49.3 66.6 56.7 78.1
tydi_telugu 21.6 27.9 65.4 42.9 63.9 52.2 66.4 44.8 71.6 66.5 75.0

Answering model: google/gemma-4-12B-it

2x compression (rate 0.5)

Method LongBench EN (7 tasks) LongBench ZH (2 tasks) TyDi-RAG, 9 languages (F1) TyDi-RAG answer hit-rate
No compression (reference) 54.4 50.2 73.8 84.2
Random word drop 43.7 43.1 41.1 29.3
LLMLingua-2 mBERT (Microsoft) 50.1 42.8 62.7 59.6
LLMLingua-2 XLM-R-large (Microsoft) 50.8 35.5 65.3 62.2
This model 50.3 43.9 60.2 58.0
prompt-compressor-xlm-roberta-large 51.1 42.2 66.6 63.8

3x compression (rate 0.33)

Method LongBench EN (7 tasks) LongBench ZH (2 tasks) TyDi-RAG, 9 languages (F1) TyDi-RAG answer hit-rate
No compression (reference) 54.4 50.2 73.8 84.2
Random word drop 38.0 40.0 25.4 15.8
LLMLingua-2 mBERT (Microsoft) 46.2 36.5 51.3 47.3
LLMLingua-2 XLM-R-large (Microsoft) 48.3 30.9 54.9 46.4
This model 42.6 39.5 50.6 45.6
prompt-compressor-xlm-roberta-large 46.4 39.1 57.2 52.9
Per-task scores
Task Random @0.5 Random @0.33 MS mBERT @0.5 MS mBERT @0.33 MS XLM-R @0.5 MS XLM-R @0.33 This model (mBERT) @0.5 This model (mBERT) @0.33 Cis Labs XLM-R-large @0.5 Cis Labs XLM-R-large @0.33 No compression
multifieldqa_en 29.5 26.5 47.9 40.4 48.2 43.3 49.8 38.5 53.1 42.9 58.7
qasper 51.6 40.2 55.3 50.4 56.0 54.7 51.0 45.6 52.5 50.4 55.5
hotpotqa 50.6 41.0 58.6 52.2 62.2 61.6 62.4 49.4 60.7 57.7 59.5
2wikimqa 42.7 38.3 56.3 51.9 54.1 46.4 52.0 39.3 57.8 44.3 62.4
musique 21.5 13.7 25.8 22.7 26.8 25.2 29.2 20.6 26.3 23.8 35.0
qmsum 20.3 19.0 21.6 20.4 20.9 20.9 21.6 20.4 21.6 21.3 21.8
triviaqa 89.6 87.1 85.1 85.1 87.7 86.0 86.0 84.3 86.0 84.3 87.7
multifieldqa_zh 61.3 56.6 62.2 50.4 46.8 38.4 61.9 53.7 57.9 51.5 72.8
dureader 24.9 23.5 23.3 22.5 24.1 23.5 25.9 25.2 26.6 26.8 27.5
tydi_arabic 40.5 30.3 64.4 58.8 59.5 49.0 65.3 59.2 67.1 61.9 71.3
tydi_bengali 37.2 20.1 58.2 53.1 67.9 56.3 57.3 46.3 68.0 57.2 75.3
tydi_english 54.4 24.7 73.0 64.1 73.0 72.0 72.3 64.4 74.1 67.1 79.7
tydi_finnish 41.0 24.9 64.5 48.7 67.5 55.2 59.3 46.2 68.2 58.5 73.8
tydi_indonesian 46.6 27.0 69.2 50.6 69.3 56.1 61.6 54.4 70.7 59.1 83.8
tydi_korean 37.6 30.2 59.0 48.8 64.1 52.9 65.3 50.6 66.1 60.1 69.9
tydi_russian 34.0 26.5 65.5 45.9 69.5 53.9 42.7 43.0 57.3 40.6 71.0
tydi_swahili 45.8 27.8 60.0 46.6 52.3 51.9 56.3 47.6 61.4 50.0 72.5
tydi_telugu 33.0 17.5 50.8 45.0 64.8 47.1 62.0 43.5 66.4 60.0 66.7

ONNX

onnx/model.onnx (fp32) and onnx/model_quantized.onnx (dynamic int8, per-channel) follow the Optimum / transformers.js layout. They output per-token logits (index 1 = keep); merging tokens into words and selecting by rate is up to the caller. Parity against PyTorch on a short multilingual probe:

file size (MB) max abs. diff in keep-prob median-split agreement
model.onnx 710 0.0000 100.0%
model_quantized.onnx 178 0.1454 100.0%

How it was trained

  • Base: google-bert/bert-base-multilingual-cased (178M params), token classification, label 1 = keep.
  • Data: Cis-Labs/prompt-compression-labels-multilingual: 30,861 labelled chunks, 28,283 pass QC (deletion-only teacher output with variation ≤ 0.10, no truncation, keep ratio 0.08–0.92).
  • Train/validation: 27,458 / 825 chunks; 3 epochs, lr 2e-5, batch 16, max length 512, cosine schedule, bf16, one NVIDIA L4.
  • Held-out agreement with the teacher: token AUC 0.892, accuracy 0.812, keep-F1 0.839.
Held-out AUC by source
Source Validation chunks AUC Accuracy
OpenAssistant conversations 80 0.890 0.804
FineWeb-Edu (English web) 107 0.890 0.808
English Wikipedia 76 0.888 0.812
FineWeb-2 arb_Arab 35 0.883 0.811
FineWeb-2 cmn_Hani 31 0.878 0.800
FineWeb-2 deu_Latn 39 0.909 0.825
FineWeb-2 fra_Latn 27 0.887 0.805
FineWeb-2 hin_Deva 32 0.878 0.797
FineWeb-2 ind_Latn 31 0.916 0.841
FineWeb-2 ita_Latn 27 0.864 0.795
FineWeb-2 jpn_Jpan 26 0.922 0.841
FineWeb-2 kor_Hang 17 0.897 0.806
FineWeb-2 nld_Latn 36 0.901 0.820
FineWeb-2 pol_Latn 32 0.904 0.824
FineWeb-2 por_Latn 45 0.911 0.823
FineWeb-2 rus_Cyrl 26 0.898 0.807
FineWeb-2 spa_Latn 26 0.879 0.801
FineWeb-2 tur_Latn 39 0.885 0.810
FineWeb-2 ukr_Cyrl 32 0.923 0.841
FineWeb-2 vie_Latn 28 0.864 0.795
QMSum meeting transcripts (train split) 33 0.874 0.784

Limitations

  • Compression is word deletion and can drop negations, units or qualifiers. Not for text where a dropped word changes a decision (legal, medical, safety).
  • Not for source code, tables or JSON; deletion breaks syntax.
  • Keep scores distil one teacher LLM's notion of importance into a 178M encoder. Compression is query-agnostic, so a detail only your query needs can be removed.
  • Languages outside the training mix rely on mBERT's multilingual pretraining; quality there is untested.
  • Chinese and Japanese: llmlingua 0.2.2 joins the kept characters with spaces (東 京 会 議), which also inflates the token count. Fix proposed upstream in microsoft/LLMLingua#266; until it is released, remove spaces between CJK characters in the output, or install that branch.

Reproducibility and credits

Code, configs, data recipe and eval harness: https://github.com/Cis-Labs-Hub/prompt-compressor

LLMLingua-2 method: Pan et al., 2024, LLMLingua-2: Data Distillation for Efficient and Faithful Task-Agnostic Prompt Compression (arXiv:2403.12968). Independent implementation by Cis Labs, not affiliated with Microsoft.


Cis Labs: AI research lab. Towards intelligence for everyone. huggingface.co/Cis-Labs · github.com/Cis-Labs-Hub

Downloads last month
49
Safetensors
Model size
0.2B params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for Cis-Labs/prompt-compressor-bert-base-multilingual-cased

Quantized
(12)
this model

Dataset used to train Cis-Labs/prompt-compressor-bert-base-multilingual-cased

Space using Cis-Labs/prompt-compressor-bert-base-multilingual-cased 1

Collection including Cis-Labs/prompt-compressor-bert-base-multilingual-cased

Paper for Cis-Labs/prompt-compressor-bert-base-multilingual-cased