#235·LLMLingua

[Bug]: When calling slingua through PromptCompressor, use_llmlingua2 should also be set to true.

Author: bzamanlooyCreated Jan 29, 2026Updated Jan 29, 2026
Labelsbug

Describe the bug

PromptCompressor(
        model_name="SecurityLingua/securitylingua-xlm-s2s",
        use_slingua=True, 
    )

on its own produces the error:

TypeError: XLMRobertaForTokenClassification.forward() got an unexpected keyword argument 'past_key_values'

. The solution is to either call:

PromptCompressor(
        model_name="SecurityLingua/securitylingua-xlm-s2s",
        use_slingua=True, 
        use_llmlingua2=True,
    )

or modify prompt_compressor.py to have

        if self.use_llmlingua2 **or self.use_slingua:**
            return self.compress_prompt_llmlingua2(
                context,
                rate=rate,
                target_token=target_token,
                use_context_level_filter=use_context_level_filter,
                use_token_level_filter=use_token_level_filter,
                target_context=target_context,
                context_level_rate=context_level_rate,
                context_level_target_token=context_level_target_token,
                force_context_ids=force_context_ids,
                return_word_label=return_word_label,
                word_sep=word_sep,
                label_sep=label_sep,
                token_to_word=token_to_word,
                force_tokens=force_tokens,
                force_reserve_digit=force_reserve_digit,
                drop_consecutive=drop_consecutive,
                chunk_end_tokens=chunk_end_tokens,
            )

Steps to reproduce

No response

Expected Behavior

No response

Logs

No response

Additional Information

No response