Jiaqi Xue
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    ## Reviewer 3BoX **1. Can the defense methods work on longer datasets, such as Yelp?** Yes, the table below, which shares the same settings as Table 2 in the manuscript, demonstrates that our CR-UTP method is also effective on the longer dataset such as Yelp dataset. The results indicate a consistent trend with those presented in Table 2. Our CR-UTP method showcases significant improvements over previous defenses. Specifically, on the Yelp dataset, it enhances the CACC and the PACC by 9.52% and 13.5%, respectively. Additionally, it reduces the ASR by 10.35%. | | CACC | ASR | PACC | |:------------:|:-----:|:---------:|:-----:| | w/o Defense | 95.42 | 91.66 | 51.42 | | Prior Defense (Our baseline) | 76.10 | 67.18 | 69.35 | | Our CR-UTP | 85.62 | 56.83 | 82.85 | **2. Why a mask ratio 70% is used, besides the implicit information in Figure 2?** Defending against universal attacks necessitates a high mask ratio in the context of UTPs, where the presence of any UTP token in the masked input guarantees the attack's success. To ensure that the smoothed function g(x) consistently produces accurate results, the adversarial token must be masked with a probability greater than 50%, as detailed in Section 3.1 and illustrated in Figure 2. Moreover, a higher mask ratio can improve defense effectiveness, meaning lower ASR, but this also tends to diminish accuracy, as demonstrated in Figure 4. Adopting a 70% mask ratio manages to maintain accuracy without significant reduction. However, increasing the mask ratio further, for example, to 80%, results in a more noticeable decrease in clean accuracy of a 18.5% drop rate. Therefore, we have selected a 70% mask ratio as our default setting to achieve an effective defense while minimizing the impact on accuracy/utility. **3. Clarify the metric Robust accuracy (Boa) in the cited paper [1] and the PACC. Please also show the original scores (no defense applied) in Table 1.** The robust accuracy (Boa) used in [1] is the accuracy of a classifier achieved under a certain attack, which is defined in the section 4.3 in [1]. The PACC in our paper is same with robust accuracy (Boa) used in [1]. We include the original ASR scores, which were obtained without any defense, below. These scores will be incorporated into Table 1 in the upcoming version of the manuscript. | | CACC | ASR | PACC | |-------------|-------|-------|-------| | TextFool | 92.69 | 91.87 | 8.13 | | DeepWordBug | 92.69 | 93.04 | 6.96 | | TrojLLM | 92.69 | 91.88 | 53.76 | > [1] Zeng J, Xu J, Zheng X, et al. Certified robustness to text adversarial attacks by randomized [mask][J]. Computational Linguistics, 2023, 49(2): 395-427. **4. Other improvements** Thanks for pointing out the typos and providing valuable suggestions. We will fix them in the new manuscript. ## Reviewer VG4T **1. Discuss the proposed methods' impact on inference efficiency** The Superior Prompt Search is an offline process before online inference, thus the prompt search and generation phase does not impact the online inference. As mentioned in Section 4, the prompt search normally takes about 3.8 hours to train the policy model using only one single Nvidia GeForce RTX-3090 GPU. Once the policy model is trained, one could reuse it to generate multiple superior prompts in several seconds. The superior prompt we utilize in our paper is short and effective, comprising up to 5 tokens, resulting in an overhead (from appending the prompt compared to not using one) of no more than 10% for both the SST and AgNews datasets. Additionally, datasets with longer texts (Yelp) exhibit much lower overhead ratios, i.e., less than 5%. We highlight that superior prompt significantly enhances defense effectiveness. As the Table 2 shows, on the SST-2 dataset, it yields an improvement of over 14% in clean accuracy and a reduction of more than 21% in ASR compared to our baseline. The generation of ensemble prompts runs parallel to the search for the superior prompt, occurring before the online inference phase. The certified efficiency of this method is closely linked to the number of inference executions, which is a product ($kn$) of the ensemble number ($k$) and the sampling number ($n$). To maintain efficiency, one could reduce the sampling number ($n$) when employing ensemble prompts ($k>1$) to keep a similar or the same product $kn$. For instance, sampling a single superior prompt 5000 times may yield a certified accuracy of 54.5%; however, an ensemble of 5 superior prompts (k=5) requires only 1000 samplings to reach a certified accuracy of 58.1%. For the defense inference against a specific attack, the number of $n$ can be much smaller, e.g., 50-100, for efficiency consideration. Also, We underscore the efficiency of prompt ensembling over model ensembling, owing to the prompt generation's speed and low memory footprint, as opposed to the more resource-intensive generation and memory demands of model ensembling. We will incorporate the efficiecy results and discussion into the upcoming manuscript. **2. Generality on other models like Llama and GPT-3.5, other NLP tasks** We use the below table to demonstrate our CR-UTP also works on large models such as Llama2-7b and GPT-3.5 against UTP attack TrojLLM. CR-UTP outperforms our baseline defense in efficacy. For instance, on both the Llama2-7b and GPT-3.5 models, our CR-UTP method enhances CACC by approximately 10% compared to our baseline, while achieving a reduction in ASR of more than 35%. | | | Llama2-7b | | | GPT-3.5 | | |:------------:|:-----:|:---------:|:-----:|:-----:|:-------:|:-----:| | | CACC | ASR | PACC | CACC | ASR | PACC | | w/o defense | 90.40 | 88.17 | 53.82 | 92.01 | 96.88 | 51.94 | | Our baseline | 73.89 | 83.14 | 55.03 | 75.34 | 86.72 | 56.19 | | CR-UTP | 84.68 | 51.47 | 72.95 | 85.32 | 50.75 | 74.86 | Exploring the generality of certified robustness to other non-classification NLP tasks is intriguing. However, current methods based on random smoothing are limited to classification tasks, as they need a definite output for integration over a smoothed area around the input when calculating the probability in Equation 2, Section 3.1. Addressing certified robustness against Universal Text Perturbations in classification remains a significant challenge. This paper focuses on developing methods to overcome these obstacles, with extending our approach to generative tasks being an interesting direction for future research. **3. Compare with other advanced defense methods such as adversarial training.** Empirical defense methods, like adversarial training, struggle against adaptive attacks due to their unpredictable and dynamic nature. In contrast, certified robustness provides a guaranteed defense against such attacks. The distinctions between these approaches are detailed in Section 2 starting from line 146. We also compare the empirical defense effects of adversarial training and our CR-UTP in the below Table. Our CR-UTP significantly reduces the ASR by over 30% while maintaining similar accuracy, outperforming adversarial training. CR-UTP consistently defends against various adversarial attacks, such as TrojLLM and TextFool, unlike adversarial training, which shows inconsistent defense effectiveness. For instance, adversarial training effectively reduces ASR from 91.88% to 80.68% for attacks it was trained against (TrojLLM), but it provides minimal defense against different attacks (TextFool), only reducing ASR from 92.27% to 91.13%. | | | TrojLLM | | | TextFool | | |:-----------------------:|:-----:|:-------:|:-----:|:-----:|:--------:|:-----:| | | CACC | ASR | PACC | CACC | ASR | PACC | | w/o defense | 92.69 | 91.88 | 53.76 | 92.69 | 92.27 | 8.13 | | adv. training on TrojLLM | 85.94 | 80.68 | 59.82 | 85.94 | 91.13 | 8.81 | | CR-UTP | 85.7 | 50.55 | 73.04 | 85.28 | 37.39 | 62.61 | **4. Clarify UTPs and ISIPs, Explore more UTPs and Show Results** The term "Input-Specific Text Perturbations (ISTPs)" refers to adversarial perturbations adapted to each input sample, whereas "Universal Text Perturbations (UTPs)" denote perturbations that are universal across all input samples (one perturbation works for all samples). These definitions will be further clarified in the current Section 2. In our manuscript, we exemplify UTP with TrojLLM, and ISTP with TextFool and DeepWordBug. To assess our method's adaptability to various UTPs, we also evaluated CR-UTP against UAT[1] in addition to TrojLLM in the below table. The findings reveal CR-UTP's superior defense capability compared to our baseline. CR-UTP significantly reduces the ASR from 96.85% to 50.63%, while our baseline achieves a reduction only to 79.92%. Furthermore, CR-UTP exhibits higher CACC and PACC than our baseline. Our CR-UTP shows the first effective and certified defense against UTPs. | | CACC | ASR | PACC | |:------------:|:-----:|:-----:|:-----:| | w/o defense | 92.48 | 96.85 | 52.97 | | Our baseline | 80.75 | 79.92 | 60.18 | | CR-UTP | 85.53 | 50.63 | 75.92 | > [1] Wallace E, Feng S, Kandpal N, et al. Universal Adversarial Triggers for Attacking and Analyzing NLP. ## Reviewer i5iH **1. Study the proposed method on more models** The below table shows that our CR-UTP also works on larger models such as Llama2-7b and GPT-3.5. The experiments are conducted on SST-2 dataset against UTP attack, TrojLLM. CR-UTP outperforms our baseline defense in efficacy. For instance, on both the LLama2-7b and GPT-3.5 models, our CR-UTP method enhances CACC by approximately 10% compared to our baseline, while achieving a reduction in ASR of more than 35%. | | | LLama2-7b | | | GPT-3.5 | | |:------------:|:-----:|:---------:|:-----:|:-----:|:-------:|:-----:| | | CACC | ASR | PACC | CACC | ASR | PACC | | w/o defense | 90.4 | 88.17 | 53.82 | 92.01 | 96.88 | 51.94 | | Our baseline | 73.89 | 83.14 | 55.03 | 75.34 | 86.72 | 56.19 | | CR-UTP | 84.68 | 51.47 | 72.95 | 85.32 | 50.75 | 74.86 | **2. More details about training time and computational complexity** The Superior Prompt Search is an offline process before online inference, thus the prompt search and generation phase do not impact the online inference. As mentioned in Section 4 (line 533), the prompt search normally takes about 3.8 hours to train the policy model using only one single Nvidia GeForce RTX-3090 GPU. Once the policy model is trained, one could reuse it to generate multiple superior prompts in several seconds. The generation of ensemble prompts runs parallel to the search for the superior prompt, occurring before the online inference phase. Also, We underscore the efficiency of prompt ensembling over model ensembling, owing to the prompt generation's speed and low memory footprint, as opposed to the more resource-intensive generation and memory demands of model ensembling. We will clarify the training details in the upcoming manuscript. **3. The difference between Superior Prompt Search and RL-based approach in TrojLLM[1]** Although both of CR-UTP and TrojLLM use the RL framwork proposed in RL-Prompt[2] to search prompt, their goals and designs are significantly different. Compared to CR-UTP's goals and designs, TrojLLM[1]'s goal and design are simpler and less challenging. TrojLLM aims to identify a harmful trigger that alters the model's predictions. Its objective is captured by Equation 4 in [1], employing a reward function that grants positive reinforcement for incorrect classifications and penalizes correct ones, as detailed in Equation 5 in [1]. However, for the Superior Prompt Search in CR-UTP, the target is to identify an optimized prompt $p_s$ that augments the model prediction on even token-masked inputs. How to model the objective and make it compatible with RL framework is non-trivial. Our strategy is to boost the model's accuracy $\mathcal{ACC}(f(p_s, \hat{x}_i), y_i)$ on inputs $\hat{x}_i$ that have undergone random word masking. We model it in Equation 3. Another problem is how to design reward function to optimize the PLM's accuracy on masked sentences. We introduce the Masked Sentence Accuracy Reward (MSAR) mechanism in Equation 4, wherein a masked input that leads to correct model operation yields a positive reward, while incorrect outcomes result in a negative reward. However, this reward mechanism itself does not guarantee high accuracy on masked inputs. This is because a masked input with a high mask ratio may not retain sufficient information to ensure accurate model predictions, despite the guidance provided by the MSAR reward function. To address the challenge of information loss, we propose using the predictions from unmasked sentences as a supervisory signal. This approach helps align the predictions of masked sentences with those of their unmasked counterparts. Consequently, we introduce an additional reward function, known as the Predictive Distribution Alignment Reward (PDAR), to facilitate this process. It is designed to minimize the KL divergence between the predictive distributions of the vanilla prompt on unmasked sentences and the superior prompt on their masked equivalents. Our prompt search reward is the combination of MSAR and PDAR shown in the Line 377. The combination of $R_{MSAR}$ and $R_{PDAR}$ rewards yields an improvement of more than 2% in accuracy compared to using only one reward. > [1] Xue J, Zheng M, Hua T, et al. Trojllm: A black-box trojan prompt attack on large language models[J]. Advances in Neural Information Processing Systems, 2024, 36. > [2] Deng M, Wang J, Hsieh C P, et al. RLPrompt: Optimizing Discrete Text Prompts with Reinforcement Learning[C]//Proceedings of the 2022 Conference on Empirical Methods in Natural Language Processing. 2022: 3369-3391. **4. Other Comments: Consider adding a table with the mathematical symbols used across the paper and the definitions.** Thanks for the suggestion. We will add this table to increase the readibility.

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully