Open soumyaamazon opened 6 months ago
Hi @soumyaamazon, thank you for your support and the detailed issue information.
This issue arises because the current structured_compress_prompt
temporarily does not support the llmlingua2 series of models. If structured_compress_prompt
is needed, it is recommended to use the llmlingua or longllmlingua series for now. We will update the support for the lingua2 series in the future.
Thank you.
Hi @SiyunZhao, wanted to confirm if the following usage can be an alternative of above i.e. Does LLMLingua 2 drop tokens using information from the instruction and question?
llm_lingua = PromptCompressor(
model_name="microsoft/llmlingua-2-xlm-roberta-large-meetingbank",
use_llmlingua2=True
)
compressed_prompt = llm_lingua.compress_prompt(context, instruction=prefix, question=suffix, rate=0.5, force_tokens=['\n', '?'])
input_text = prefix + compressed_prompt['compressed_prompt'] + suffix
Hi @soumyaamazon, thank you for your support and the detailed issue information.
This issue arises because the current
structured_compress_prompt
temporarily does not support the llmlingua2 series of models. Ifstructured_compress_prompt
is needed, it is recommended to use the llmlingua or longllmlingua series for now. We will update the support for the lingua2 series in the future.
What models would you recommend? I'm seeing this issue with the default model in PromptCompressor() ('NousResearch/Llama-2-7b-hf'), as well as phi-2.
Specifically, I want to only compress the last field, and keep the few-shot intact, but the model will compress part of the prompt that I asked not to be compressed.
structured_prompt = """<llmlingua, compress=False>QUESTION: The Peach belongs to a group of seedless fruit. True or false?
REASONING: Peaches have one large seed surrounded by the flesh of the fruit.
ANSWER: False.
QUESTION: The band Lynyrd Skynyrd formed up in Beijing, China. True or false?
REASONING: They formed in Jacksonville, Florida.
ANSWER: False.
QUESTION: Only people named Floyd wearing pink are allowed to attend Pink Floyd concerts. True or false?
REASONING:</llmlingua><llmlingua, rate=0.2> The rock group would not be as popular if they had such requirements for their concerts.</llmlingua>"""
compressed_prompt = llm_lingua.structured_compress_prompt(structured_prompt, instruction="", question="", rate=0.2)
The result is:
{'compressed_prompt': 'QUESTION: The Peach belongs to a group of seedless fruit. True or false?\nREASONING: Peaches have one large seed surrounded by the flesh of the fruit.\nANSWER: False.\n\nQUESTION: The band Lynyrd Skynyrd formed up in Beijing, China. True or false?\nREASONINGQUESTION: Only people named Floyd wearing pink are allowed to attend Pink Floyd concerts. True or false?\nREASONING: The rock group would not be as popular if they had such requirements for their concerts.', 'origin_tokens': 118, 'compressed_tokens': 105, 'ratio': '1.1x', 'rate': '89.0%', 'saving': ', Saving $0.0 in GPT-4.'}
which has removed the second shot example.
Thanks in advance!
Describe the bug
Model:
Prompt:
Code:
Output:
Steps to reproduce
Mentioned above.
Expected Behavior
The part which is wrapped in compress=False tag shouldn't have been compressed.
Logs
No response
Additional Information
No response