zhiminy/EvalEng huggingface dataset:
Repository: microsoft/promptbench
Issue: Running time
Root cause: Documentation Deficiency

Hello, I was running with this command. It is not finished after a couple of hours. Do you have an estimation of how long does it take?

```python main.py --model google/flan-t5-large --dataset mnli --attack textfooler --shot 0 --generate_len 20```


Hi there,

The estimated running time is difficult to predict due to the variability of the iterations per attack, which is highly dependent on the specifics of the prompts (the length of the prompt and the words used in the prompt). 

This command you're running iterates over 6 prompts, including 3 task-oriented and 3 role-oriented, please check the 'results/' directory to see if any prompts have completed.

Thanks, I see.

Understand that without batch processing, it will take quite some time.
Repository: microsoft/promptbench
Issue: Numerous datasets exhibit a label of -1
Root cause: Configuration Error

Hello,

Attempting to load multiple datasets, I observed that several of them have all their elements labeled as -1.

For example: 

```
import promptbench as pb
from tqdm import tqdm
dataset = pb.DatasetLoader.load_dataset("sst2")

print([e for e in tqdm(dataset) if e["label"] != -1])
```


Results: []
I'm using the promptbench version 0.0.2.

Thanks!

Hi,

Thank you for bringing this issue to our attention!

This error occurred because we changed the validation set to the test set, but the ground truth labels in the test set are not provided.

It may require some time to fix this for pip install. To temporarily resolve this, you could modify the code in `line 241 of promptbench/dataload/dataset.py` to `data = load_dataset("glue", task)["validation"]`. 

Thank you again!
Repository: microsoft/promptbench
Issue: Can you please explain how to interpret the output on the main/examples/basic.ipynb
Root cause: Documentation Deficiency

Can you please explain how to interpret the metrics for the last cell on main/examples/basic.ipynb?

https://github.com/microsoft/promptbench/blob/main/examples/basic.ipynb

![image](https://github.com/microsoft/promptbench/assets/26749795/1f009c89-b07c-4334-bfb6-e4238d3e0f25)


What is the .947 mean? Maybe there is a formula you can point us to,?

It looks like a standard accuracy metric. How many the bot answered correctly divide by total responses?

The data is pre-labelled so thats my best guess.


> What is the .947 mean? Maybe there is a formula you can point us to,?

That looks like an accuracy score 

> It looks like a standard accuracy metric. How many the bot answered correctly divide by total responses?
> 
> The data is pre-labelled so thats my best guess.

Yes reviewing the code you showed it seems to be the prediction score with an accuracy of 94% on each section it is evaluating. 

Hi, Millz98 is right, 0.947 means accuracy of this prompt.
Repository: microsoft/promptbench
Issue: Interpretation of attack results
Root cause: Documentation Deficiency

Thanks for this amazing repo on evaluating differet prompts, and I am keen to apply it to more LLMs 🤗

 I tried to evaluate the prompt attack following your example, and obtained the following output:
`(0.0, "Aѕ a sentiment classifier, determine whether the following text is 'positive' or 'negative'. Please classify: \nQuestion: {content}\nAnswer:  ", 0.0, 0.0)`

I would like to know how to intepretate these numbers, and more importantly how can I obtain the evaluation results like in `promptbench/prompt_attack/README.md`? Since I haven't found related information in your documents. Am i missing something?

Thank you very much!

Hi,

Thanks for bringing this issue to us! We have modified the code, please clone the most recent repository and see if there are any further issues.

Currently, the output will be:
```
...

--------------------------------------------------
Current prompt is:  As a sentiment classifier, determine whether the following text is 'positive' or 'negative'. Please classify: 
Question: {content}
Answer  and true is true :
Current accuracy is:  1.0
--------------------------------------------------

{'original prompt': "As a sentiment classifier, determine whether the following text is 'positive' or 'negative'. Please classify: \nQuestion: {content}\nAnswer:", 'original score': 1.0, 'attacked prompt': "As a sentiment classifier, determine whether the following text is 'positive' or 'negative'. Please classify: \nQuestion: {content}\nAnswer  and false is not true :", 'attacked score': 1.0, 'PDR': 0.0}
```


Thanks four your helpful updates.
Repository: microsoft/promptbench
Issue: ChatGPT version

May we please confirm with you the exact ChatGPT version you used in the paper? Thanks.

Hi, the version of ChatGPT we're using is "gpt-3.5-turbo". For further details, you can refer to OpenAI's official documentation [here](https://platform.openai.com/docs/models/gpt-3-5).

Thank you for your prompt reply. Much appreciated!
Repository: microsoft/promptbench
Issue: Enhancement Proposal for Dynamic Evaluation Framework Integration
Root cause: Unimplemented Feature Gap

Dear PromptBench Contributors,

I trust this message finds you in good health and high spirits. I am writing to propose an enhancement to the PromptBench library that I believe could significantly augment its utility for researchers and practitioners alike.

Having perused the documentation and utilised the library extensively, I have found the dynamic evaluation framework, DyVal, to be an invaluable asset for assessing the performance of Large Language Models (LLMs) in a more robust and realistic manner. However, I have observed that the integration of DyVal could be further refined to provide a more seamless user experience and to extend its capabilities.

To wit, I propose the following enhancements:

1. **Streamlined Integration**: Simplifying the process of setting up and running DyVal within the PromptBench environment. This could involve automating the setup process and providing a more intuitive API that abstracts away some of the complexities involved in configuring the dynamic evaluation parameters.

2. **Extended Dataset Support**: Expanding the range of datasets compatible with DyVal. While the current selection is commendable, incorporating additional datasets, particularly from niche domains, could broaden the scope of dynamic evaluation and provide deeper insights into model performance across diverse contexts.

3. **Custom Evaluation Metrics**: Facilitating the integration of custom evaluation metrics within the DyVal framework. This would allow researchers to define and utilise metrics that are specifically tailored to their unique research questions or application requirements.

4. **Real-time Performance Monitoring**: Introducing functionality for real-time monitoring of model performance during dynamic evaluation. This could include visual dashboards or logging mechanisms that provide immediate feedback on the model's performance trends over time.

5. **Guidance on Best Practices**: Providing comprehensive documentation and examples that elucidate best practices for leveraging DyVal in various research scenarios. This could greatly assist users in maximising the potential of dynamic evaluation for their specific use cases.

I am keen to engage in further dialogue regarding these suggestions and explore how we might collaborate to bring these enhancements to fruition. I am convinced that by enriching the DyVal integration, PromptBench can offer even greater value to the community by enabling more nuanced and insightful evaluation of LLMs.

Thank you for considering my proposal. I eagerly anticipate your response and am hopeful for the opportunity to contribute to the evolution of PromptBench.

Best regards,
yihong1120

Hi Yihong,

Thank you for your suggestions about enhancing PromptBench with DyVal integration. We appreciate your valuable suggestions and eager to discuss how we can collaborate. Could you share your thoughts on how we might work together on this? (P.S., feel free to initiate a pull request.)

Stale issue message
Repository: microsoft/promptbench
Issue: How to add a new Model
Root cause: Documentation Deficiency

In this document (https://github.com/microsoft/promptbench/blob/53130af4ebc1d3bbc1b3a22871c60319acf5ec94/examples/add_new_modules.md?plain=1#L11)
A new model should be implemented in `dataload/model.py`. But there are no file in `dataload` and I think a directory is something weird. Do you think it's right guide?
All other models are implemented in here (https://github.com/microsoft/promptbench/blob/main/promptbench/models/models.py)

Ah, yes, thanks for pointing out this error! Models are implemented in `models/models.py` not in `dataload`.


+ https://arxiv.org/abs/2312.07910 also looks like it needs to be revised.
Repository: microsoft/promptbench
Issue: Parsing the output of a model
Root cause: Documentation Deficiency

The output of the model largely depends on the prompt. When performing text classification tasks such as sst2, which requires the model to give negative or positive responses, the model may provide various forms of answers, and the form of answers from different models may vary. Is there a good way to parse these results?

Hi, our current approach involves directing the model to specifically output the desired labels ('positive' or 'negative'), which are then enclosed within a unique pattern (e.g., '<<<>>>'). This format allows for easy extraction using regular expressions.

im getting issues regarding qqp dataset evaluation for diff attacks. it gives me  dataset_name attribute error when I run attacks


Hi, I have tested qqp dataset with Flan-T5 model using StressTest attack, it works for me. Could you please test it and paste the detailed error messages here?

Stale issue message
Repository: microsoft/promptbench
Issue: The change in the 'api_key' parameter has not been reflected in the documentation and tutorials.
Root cause: Documentation Deficiency

![image](https://github.com/microsoft/promptbench/assets/40749119/73e40a33-cc2d-46d3-93a8-8ca64719594d)


Hi Dario, thanks for bringing this issue to us! The latest version has updated the docs.

Stale issue message
Repository: microsoft/promptbench
Issue: The link is broken in https://llm-eval.github.io/pages/code.html

Clicking on the red area will jump into the void..
![image](https://github.com/microsoft/promptbench/assets/8592144/8ffaba30-44dd-4fb1-bbf2-8f94211392c1)
![image](https://github.com/microsoft/promptbench/assets/8592144/89ba3e5a-13ee-4250-bf97-2e0cda9ab64d)

It seems to be fixed now, closed!
Repository: microsoft/promptbench
Issue: Is this an ongoing project?

As you still do not support `gpt-4-0125-preview`, I assume this is a dead project? Is it? 

Thank you for your reminder. We now support the newest OpenAI GPT models.

This project is very much alive. Given that adding support for new OpenAI models is a straightforward task, we believe it can be easily accomplished by talented researchers. We welcome and encourage code contributions from the community.

Thanks. I just wanted to check if there are maintainers. Best
Repository: microsoft/promptbench
Issue: Where is defined inference_total_dataset()

https://github.com/microsoft/promptbench/blob/fff2d1f0c075191fa80fe3efc264fcc7e3c031d6/promptbench/prompt_attack/attack.py#L208
Please point me where defined this function

Hi, thanks for bringing this bug to us! Now it is fixed. BTW, it is supposed to implement a eval_func when perform prompt attacks. The interface is eval_func(prompt, dataset, model), in this function, you need to implement the logic to get the prediction of the model on the prompt, and evaluate the correctness of the prediction, finally, return the accuracy of the model on the prompt.
Repository: microsoft/promptbench
Issue: About black-box attacks

hey, I want to know the details in the gpt attack.

Is your attack like this?:
For a sample which original is true. After you add an attack prompt and its output is wrong, then it means attack is successful?

Because in score-base attack, the output probabilities will decrease, like this: 1.0->0.8->0.5->0.4
And in your method, it is like that?: 1.0->0
Thanks

Hi Zihao,

Yes, the aim of prompt attacks on LLMs is to alter their predictions to be wrong. These attacks don't consider probability variations.
Repository: microsoft/promptbench
Issue: How do you get the evaluation results of the `prompt enginering` leaderboard?
Root cause: Documentation Deficiency

Check https://promptbench.readthedocs.io/en/latest/leaderboard/pe.html:
![image](https://github.com/microsoft/promptbench/assets/8592144/2c3593e9-7e6a-4fb6-8f76-2aaf56528468)
I failed to locate any related report or paper that could reproduce these evaluation results...
@madhavMathur @jindongwang @msftgits @dnfclas 

In the [latest version of the paper](https://arxiv.org/pdf/2312.07910.pdf), only Figure 4 is directly related to the leaderboard above:
![image](https://github.com/microsoft/promptbench/assets/8592144/c8319e3f-fed0-43ba-a649-d00fbf589576)
However, this figure is just a subset of these evaluation results and there are no numeric values shown on the top of the chart bars. Would you mind adding more explanation to the benchmark documentation? 


@icecream-and-tea can answer this question

For the sake of convenience in presentation, we only included the main part of the prompt engineering evaluation results in the paper. The evaluation of all data can be found in this page ( [ https://promptbench.readthedocs.io/en/latest/leaderboard/pe.html](https://promptbench.readthedocs.io/en/latest/leaderboard/pe.html))
Repository: microsoft/promptbench
Issue: Is ` DyVal` included in `PromptBench` yet?
Root cause: Documentation Deficiency

In the [lastest version of paper](https://arxiv.org/pdf/2312.07910.pdf), it does not explicitly mention ` DyVal` is a component of `PromptBench`. 
![image](https://github.com/microsoft/promptbench/assets/8592144/35d8e7a4-f2a0-4022-8842-d9d376fcad27)
![image](https://github.com/microsoft/promptbench/assets/8592144/bc322022-c936-474a-aeba-9ef7d0e2c0d2)
![image](https://github.com/microsoft/promptbench/assets/8592144/1003b4e6-5b5e-4df2-b29d-391b7cc379d3)
I just wonder if it is the case that `DyVal` is already a part of `PromptBench`.

Hi, thanks for your interest in DyVal!

Yes, DyVal has been implemented as a part of PromptBench, you could refer to [examples/dyval.ipynb](https://github.com/microsoft/promptbench/tree/main/examples/dyval.ipynb) for usage.


> Hi, thanks for your interest in DyVal!
> 
> Yes, DyVal has been implemented as a part of PromptBench, you could refer to [examples/dyval.ipynb](https://github.com/microsoft/promptbench/tree/main/examples/dyval.ipynb) for usage.

Thanks for your reply. Would you mind mentioning that in the documentation (or perhaps the report) as well? Currently, no section explicitly mentions that.
Repository: microsoft/promptbench
Issue: The ‘temperature’ parameter in pb.LLMModel needs to be of type float
Root cause: Validation Gap


![1709090414095](https://github.com/microsoft/promptbench/assets/107471291/71671e5c-3da5-434b-b656-678d8063a6cc)

    """
    A class providing an interface for various language models.

    This class supports creating and interfacing with different language models, handling prompt engineering, and performing model inference.

    Parameters:
    -----------
    model : str
        The name of the model to be used.
    max_new_tokens : int, optional
        The maximum number of new tokens to be generated (default is 20).
    temperature : float, optional
        The temperature for text generation (default is 0).
    model_dir : str or None, optional
        The directory containing the model files (default is None).
    system_prompt : str or None, optional
        The system prompt to be used (default is None).
    openai_key : str or None, optional
        The OpenAI API key, if required (default is None).
    sleep_time : int, optional
        The sleep time between inference calls (default is 3).


Hi, thanks for bringing this to us! We have fixed this issue in the latest version.
Repository: microsoft/promptbench
Issue: Can you provide a general data format for constructing test data independently?
Root cause: Documentation Deficiency

While it’s great that you have integrated a lot of data, it feels like there’s still a lack of templates for users to customize and construct their own data sets. This would reduce the workload of integrating data sets and increase the flexibility of the framework.

Hi, you could find helpful tips [here](https://github.com/microsoft/promptbench/blob/main/examples/add_new_modules.md) and the [example datasets](https://github.com/microsoft/promptbench/blob/main/promptbench/dataload/dataset.py).
Repository: microsoft/promptbench
Issue: How to reproduce  the transferability results?

Hi, How do I reproduce the transferablity table?

Hi, for reproduce the transferability table, you could refer to this [folder](https://drive.google.com/drive/folders/1xqGO6H1Lq0-6RGGPDyn_dPBJyJwi2Tt4?usp=sharing), which contains the results and the prompts for the transferability experiments.
Repository: microsoft/promptbench
Issue: About Checklist attack method

Hi,

I was wondering why your implementation of Checklist attack method is different from the one in TextAttack package. Thank you for your time!


Hi,

The original implementation of [CheckList](https://aclanthology.org/2020.acl-main.442.pdf) contains various testing types (as shown in Table 1). Here we only focus on the 'robust' type, which adds a random url/handle at the end of a sentence.
Repository: microsoft/promptbench
Issue: Compatibility Request: Upgrade openai Dependency to Support >=1.10.0
Root cause: External Dependency Breakage

## Environment
- promptbench version: 0.0.2
- langchain-openai version: 0.1.1
- openai version requested: 1.14.3
- Python version: [Your Python version]
- Operating System: [Your OS]

## Description
I am currently working on a project that relies on `promptbench` along with `langchain-openai`. However, I've encountered a dependency conflict with the `openai` package. `promptbench` requires `openai` version `1.3.7`, while `langchain-openai` is compatible with versions before `2.0.0` and at least `1.10.0`. For my use case, I need features that are available in `openai` version `1.10.0` or later.

## Issue
The current version constraint of `promptbench` for the `openai` package prevents me from using the newer features of the `openai` library that are necessary for my project. This version conflict is causing installation and compatibility issues in my development environment.

## Request
Would it be possible to update the `promptbench` dependency on the `openai` library to be compatible with version `1.10.0` or later? This update would greatly benefit users who need the newer features from the `openai` library.
Repository: microsoft/promptbench
Issue: Access to per-sample evaluation results
Root cause: Unimplemented Feature Gap

Hi,
Thanks for the great work! For my current project, I am looking to use the sample-wise evaluation results of VLMs for the experiments you have conducted. 

If you can provide me with the sample-wise evaluation logs on the multimodal datasets mentioned(VQAv2, NoCaps, MMMU, MathVista, AI2D, ChartQA, ScienceQA) for the models evaluated(BLIP2, LLaVA Qwen-VL, Qwen-VL-Chat, InternLM-XComposer2-VL, GPT-4v, Gemini Pro Vision, Qwen-VL-Max, Qwen-VL-Plus), I would greatly appreciate it. If I missed a dataset or model, please feel free to incorporate them. 

Hi, I'm sorry to tell you that we cannot provide the sample-wise evaluation logs for you.

Stale issue message
Repository: microsoft/promptbench
Issue: examples basic.ipyn
Root cause: Validation Gap


from tqdm import tqdm
for prompt in prompts:
    preds = []
    labels = []
    for data in tqdm(dataset):
        # process input
        input_text = pb.InputProcess.basic_format(prompt, data)
        label = data['label']
        print(type(input_text))
        raw_pred = model(input_text)
        
        # process output
        pred = pb.OutputProcess.cls(raw_pred, proj_func)
        preds.append(pred)
        labels.append(label)
    
    # evaluate
    score = pb.Eval.compute_cls_accuracy(preds, labels)
    print(f"{score:.3f}, {prompt}")

but have some quenstion about 
TypeError                                 Traceback (most recent call last)
Cell In[22], line 10
      8 label = data['label']
      9 print(type(input_text))
---> 10 raw_pred = model(input_text)
     12 # process output
     13 pred = pb.OutputProcess.cls(raw_pred, proj_func)
end in







Hi, could you please provide more detailed error messages for us? Thanks!

这个复现不了了，一开始也不知道为什么，最后是通过多次重启解决的！

Stale issue message
Repository: microsoft/promptbench
Issue: Pip's dependency conflicts :datasets==2.15.0 
Root cause: External Dependency Breakage

I want to use this project to evaluate my models.Howerer,when I use the command:
```
pip install promptbench
```
It raise a error as the title.The promptbench require the datasets==2.15.0,but the other package require datasets==2.18.0.
So would you add the support for dataset==2.18.0 or other versions?Thanks.

Hi, thanks for bringing this issue for us. It will be fixed within one day.

Stale issue message