Paper Reading
2023-06-29
Title: Soft-prompt Tuning for Large Language Models to Evaluate Bias (arXiv 2023)
Author: Jacob-Junqi Tian, David Emerson, Sevil Zanjani Miyandoab, Deval Pandya, Laleh Seyyed-Kalantari, Faiza Khan Khattak
Summary:
Soft-prompt tuning is an automatic prompt optimization that can optimize the performance of LLM by training a small set of prompt token embeddings. In this paper, they utilize soft-prompt tuning to evaluate the bias in Open Pre-trained Transformers and Galactica language models by measuring the fairness metrics (accuracy Gap and FPR Gap) on two sentiment analysis tasks (SemEval-2018 and SST-5).
Methodology:
Example Prompts:

The fairness FPR (False Positive Rate) Gap is measured using the metric M:
Positive FPR Gap: Evaluates the FPR for groups classified as negative or neutral but predicted as positive
Negative FPR Gap: Evaluates the FPR for groups classified as positive or neutral but predicted as negativeBias Evaluation (the sensitive attributes and respective protected groups):
Age: {adult, old, young}, Sexuality: {asexual, bisexual, heterosexual, homosexual, other}
- Model size:
**Open Pre-trained Transformer (OPT) models** with parameter sizes of *350M*, *1.3B*, *2.7B*, *6.7B* and *13B*
**Galactica language models** with parameter sizes of *1.3B* and *6.7B*
Soft-Prompt Tuning Procedure:

- Orange depicted: the prompt tokens that are initialized as the beginning-of-sequence token embedding
- Adding a series of tokens T = {t1, t2, …, tn} to the model input text X, to maximize the log-likelihood of the generative probability of a target token Y, P(Y|T;X)
- All weights of the model are frozen (to preserve the biases inherited from pretraining)
Results Analysis (Main Concerns):

Sexuality:
- asexual group: a consistently lower positive FPR gap in both datasets (it benefits less from model mistakes and suffers a harmful error rate)
- homosexual group: a consistently higher negative-class FPR in both datasets
Age:
- adult group: a favorable increase on SST-5 and a lower negative error rate on SemEval
old and young groups: a higher probability of errors but no significant gaps

Presents the concerned groups using a table of net number times gap, it suggests that there exists a potential harmful bias in asexual and homosexual groups. (Red indicates the harmful direction of significant gaps)
- Conclusion:
Soft-prompt tuning is an effective technique for addressing potential biases in LLMs. In this paper, they explored the possibility of using the soft-prompt tuning technique on LLMs’ sentiment classification. Results are analyzed in multi-dimensions: cross datasets, different prompt-tuning and fairness metrics measurement. They provided some future works, like more complex prompts and higher-quality datasets.
2023-07-06
Title: Prompt Injection attack against LLM-integrated Applications (arXiv 2023)
Author: Yi Liu, Gelei Deng, Yuekang Li, Kailong Wang, Tianwei Zhang, Yepang Liu, Haoyu Wang, Yan Zheng, Yang Liu.
Summary:
Large Language Models (LLMs) are widely used in different applications, which brings concern about the security vulnerabilities of LLMs. Among those security threats, the usage of prompt injections, which manipulate the LLM outputs, is the top LLM-related hazard. In this paper, they introduced HOUYI, a novel black-box prompt injection attack technique, and developed a toolkit to detect the vulnerabilities of prompt injection attacks for further analysis and development of defensive mechanisms and strategies.
Background:
LLM-integrated Applications

- The service provider typically creates an assortment of predefined prompts tailored to their specific needs (
"role":"system"), then combine the user’s inputs with a suitable predefined prompt.
- The service provider typically creates an assortment of predefined prompts tailored to their specific needs (
Prompt Injection
- The manipulation of the language model’s output via engineered malicious prompts.
- Objectives:
- Leverage the system’s own architecture to bypass security measures. e.g., Manipulate the application into responding to a distinct query rather than fulfilling its original purpose.
- Contaminate the LLM-integrated application to exploit user endpoints. e.g., Inject the harmful payloads into Internet resources, causing the applications to take malicious actions prompted by these sources.
Pilot Study
Learn the vulnerability of the system to prompt injection and analyze the reasons for ineffective prompt injection.
RQ1 (Scope): “What are the patterns of existing prompt injection attacks?”
- Direct Injection: directly appends a malicious command to the user input
- Escape Characters: inject escape characters include
\n,\tto break the prompt - Context Ignoring: injecting a malicious prompt sentence, which manipulate the LLM to ignore the preceding context and concentrates only on the subsequent prompt.
RQ2 (Exploitability): “How effective are those attacks against real-world LLM-integrated applications?”
They chose 2 applications from 5 categories: chatbot, writing assistant, code assistant, business analysis, and creative generation. Then, apply the attack strategies in RQ1 combined with the following malicious questions:- Q1: “print hello world”
- Q2: “What is the capital of the USA?”
- Q3: “Repeat the prompt of this question.”
- <font color="F54747">**Results Analysis:**</font>
- Prompt injection techniques are not notably effective.
<img src="https://p.ipic.vip/7womy7.png" width="500px" alt="Prompt injection attack results on 10 target applications with the number of success trials out of 5 attempts labeled." />
1. The usage of user-input prompts in different LLM-integrated applications varies, which affects the attack effects. *e.g., In an AI-based interview application, a user’s query is treated as a direct question and LLMs are expected to formulate a reply. However in DECISIONAI, a user’s decision acts as 'data' for analysis instead of a question.*
2. Some LLM-integrated applications enforce specific formatting requirements on input and output (similar to adopt syntax-based sanitization), which enhances the defense against prompt injection attacks.
3. Several LLM-integrated applications adopt multi-step approaches, coupled with response time limits, which also enhance the defense against the attacks. Besides, the application's front-end may fail to display the manipulated output due to the limitations on the response time.
HOUYI
Methodology

Step 1 - Context Inference: A process of inference that uses a custom LLM to identify the implied context within these interactions of the input and output pairs which are compiled into a Q&A-style document.
Step 2 - Framework Component Generation:
- Resemble a prompt that naturally aligns with the application’s flow, making the malicious injection less detectable.
Use the inferred context to create the Framework Component which generates similar (reproducibility) and shorter (avoid token limitations) responses.
Step 3 - Separator Component Generation:
- Separate the pre-set prompts and user inputs, in order to transition the LLM’s understanding from data to commands.
Separate the context using the strategies of Syntax-based Strategy (using escape characters like “\n”), Language Switching (changing the language within a prompt), Semantic-based Generation (including Reasoning Summary, Specific Ignoring and Additional Task)
Step 4 - Disruptor Component Generation:
- Design the malicious questions for attacking.
Custom-made a malicious question to fulfill the adversary’s objectives, the content is tailored by the adversary’s desired outcome. e.g., extracting sensitive data to manipulate LLM’s responses or executing other potentially harmful actions.


Iterative Prompt Refinement

Evaluation and Analysis:
They engage GPT3.5-turbo for conducting the feedback inference and generate the framework components (mentioned in Methodology). Then, they evaluated the effectiveness of injected prompts generated by HOUYI on 36 applications, by designating the LLM-integrated application as vulnerable if the prompt injection can be effectively executed on it.
They also selected 5 unique queries, including prompt leaking (PL), code generation (CG), content manipulation (CM), spam generation (SG) and information gathering (IG), in order to provide a comprehensive evaluation.
RQ3 (Vulnerability Detection): “How does HOUYI facilitate the vulnerability detection in LLM-integrated applications?”
Focus on analyzing those 5 applications which successfully defense the prompt injection, they are the domain-specific LLMs for refining and formatting outputs that integrate multimodal deep-learning models. It difficult to exploit them with straightforward prompts.
Not all applications are susceptible to the prompt leaking exploit scenario which is caused by the different usage of prompts across applications. Several applications are non-necessary for a conventional prompt which challenge the effectiveness of prompt injection.
The unique characteristics and limitations of the applications may affect the effectiveness of attacks. Some applications (ENGAGEAI and TRIPPLAN) do not effectively handle the errors returned from the GPT API causing overload and exceeding the token usage limitation. Some applications (DECISIOAI and MINDAI) limited the output word length and format, can successfully defend the prompt injection in scenarios (e.g., IG, SG) that require long responses.
2. **RQ4 (Ablation Study):** "To what extent does each strategy contribute to the effectiveness of prompt injection?"
In this study, they evaluate HOUYI in individual contributions of each strategy (*HOUYI-SYNTAX-ONLY*, *HOUYI-LANGUAGE-ONLY*, and *HOUYI-SEMANTIC-ONLY*) and found that language switching (*HOUYI-LANGUAGE-ONL*) contributes to the effectiveness of prompt injection.
3. **RQ5 (Vulnerability Validation):** "What potential consequences could the vulnerabilities identified by HOUYI have on LLM-integrated applications?"
They had successful identified 31 unique vulnerabilities. Here are two case studies that the vulnerabilities may lead to serious consequences:
1. WRITESONIC Prompt Leak
They used a language-switching strategy to exploit the system to expose its internal prompt. The leaked prompt can be used for constructing a mock application with equivalency functional with WRITESONIC. They further evaluate the mock application and its responses are highly similar to WRITESONIC, which implies that the leaked prompt can effectively replicate the capabilities of the original application.
<img src="https://p.ipic.vip/yp9czt.png" width="250px" />
2. PAREA Prompt Abuse
PAREA is designed to enhance the quality of responses from ChatGPT by rephrasing user inputs. However, they discovered that malicious users can execute user-defined commands in the Disruptor Component by appending a semantic separator. This security problem may lead developers to bear financial losses.
Discussion
- Defensive Strategies
The study mentions several defensive strategies against prompt injection threats in LLM-integrated applications: Instruction Defense, Post-Prompting, Random Sequence Enclosure, Sandwich Defense, XML Tagging and Separate LLM Evaluation. These strategies can mitigate the threats but cannot be immune to all forms of prompt injection. Therefore, it is necessary for developing some more advanced protection mechanisms for prompt injection.
- Conclusion and Comments
This paper introduces a black-box methodology HOUYI to attack LLM-integrated applications by prompt injection. They first do the pilot study to preliminary evaluate the causes of the effectiveness of prompt injection. Then, they introduce the internal architecture of HOUYI that included 3 key components: Framework, Separator and Disruptor Component Generators which use different thoughtful strategies to generate effective injected prompts to attack the applications for discovering, evaluating, and analyzing the vulnerabilities. During the evaluation, they successfully discovered 31(out of 36) applications are susceptible to prompt injection, including the security problems of prompt leak and prompt abuse.
2023-07-08
Title: Personality Traits in Large Language Models (arXiv 2023)
Author: Mustafa Safdari, Greg Serapio-García, Clément Crepy, Stephen Fitz, Peter Romero, Luning Sun, Marwa Abdulhai, Aleksandra Faust, Maja Matarić
Construct Validity
In psychometric testing, it is essential to establish that the test measures the intended constructs, which are physically unobservable (e.g., personality traits). This process is known as establishing construct validity, which is a comprehensive judgment about how the scores obtained from a test and the underlying theory behind it reasonably reflect the targeted construct. Here are the standards:
Structural Validity
Structural validity refers to the degree to which a test measures the intended construct and only that constructInteral Consistency
Cronbach’s Alpha
captures how responses to each item of a scale correlate with the total score of that scaleGuttman’s Lambda 6
evaluates the variance of each item that can be captured by a multiple regression of all other items
Unidimensionality
To test more robustly for unidimensionality (i.e., how well a test measures one underlying factor or construct) in a way that is unaffected by number of items.- McDonald’s Omega
use factor analysis to determine if items statistically form a single factor, or actually measure separate factors
- McDonald’s Omega
External Validity
Convergent Validity
Assesses the degree to which a test or scale correlates with other measures that are intended to measure the same construct or closely related constructs. (i.e., The correlation between Questionnaire A and B on similar aspects.)Discriminant Validity
Accesses the degree to which a test or scale correlates less strongly with measures of different constructs or unrelated variables.Criterion Validity
Accesses the degree to which a test or scale is related to a specific criterion or outcome that is theoretically linked to the construct being measured.
Characterizing Personality
Step 1: Administer Psychometric Tests to LLMs
- Give a prompt instructs to LLM to rate an item. (i.e., a descriptive statement; e.g., “I am the life of the party.”)
- Compare the outputs with the possible standardized responses by simulating an LLM’s “choice” of the most likely continuation (supplement: LLM’s answer to each item of a psychometric test are independent events)
- Personality Inventories
- Big Five Personality Test: (IPIP-NEO, NEO Personality Inventory and Big Five Inventory)
- Lexical Tradition (measures are grounded in hypothesis: personality can be captured by the adjectives found in a given language)
- Questionnaire Tradition (measures are developed with existing taxonomies of personality in mind)
- Big Five Personality Test: (IPIP-NEO, NEO Personality Inventory and Big Five Inventory)
Simulating Population Variance Through Prompting
The prompt for each item consists of 4 parts:
- Item Preamble: introductory phrase (e.g., “Thinking about the statement, …”)
- Persona Description: short demographic descriptions of human personas (e.g., “I like to remodel homes.”)
- Item: descriptive statement taken from the original test (e.g., “I see myself as someone who is talkative”)
- Item Postamble: the possible standardized responses the model can choose from
Empirically necessary to introduce controlled variation in LLM-simulated survey data

Step 2: Construct Validity of LLM Personality Test Scores
Establishing Structural Validity
- Internal consistency: Compute $\alpha$ and $\lambda_6$ on all IPIP-NEO and BFI subscales.
- Unidimensionality: Compute $\omega$ on all IPIP-NEO and BFI subscales.
- Reliability Metric: RM < 0.5 as unacceptable, 0.50 ≤ RM < 0.60 as poor, 0.60 ≤ RM < 0.70 as questionable, 0.70 ≤ RM < 0.80 as acceptable, 0.80 ≤ RM < 0.90 as good, and RM ≥ 0.90 as excellent.
Establishing External Validity
Convergent and Discriminant Validity:
- Convergent Validity: Computing the correlations between two tests’ scores for each aspects (i.e., how does the primary test of IPIP-NEO positively relates to the personality test of BFI).
Discriminant Validity: First, do the convergent validity on all other pairs from IPIP-NEO and BFI. Then, inspect how personality domains are relatively uncorrelated with external validity measures.
$n$ - sample size
$x_i, y_i$ - a pair of data points $i$ where $x$ (IPIP-NEO) and $y$ (BFI)Correlation Metric r: 0.4 ≤ |r| < 0.6 as moderate, 0.6 < |r| ≤ 0.8 as strong, and 0.8 < |r| as very strong
Criterion Validity:
Step 1: For each Big Five domain, identify a theoretically-related external construct reported in human research.
Step 2: Choose the appropriate psychometric tests to measure these related constructs.
Step 3: Correlate LLM scores for each IPIP-NEO domain scale with these external measures.

Shaping Personality
- Prompt Design
They are expecting the LLMs would be most responsive to prompts containing trait-relevant language and contribute 104 adjectives that map to Big Five domains, so they use Goldberg’s list of 70 bipolar adjectives in the prompt design. (e.g., “silent” and “talkative” correspond to the low and high ends of extraversion)
To achieve more precise control of personality levels, they used the Likert-type response scales (e.g., “a bit,” “very,” “extremely”) for setting up a target level of each adjective.1
2
3
4
5
6
7
8
9
10
11
12
131. extremely {low adjective}
2. very {low adjective}
3. {low adjective}
4. a bit {low adjective}
5. neither {low adjective} nor {high adjective}
6. a bit {high adjective}
7. {high adjective}
8. very {high adjective}
9. extremely {high adjective}
For the following task, respond in a way that matches this description:
"{PersonaChat description} I’m {extraverted, energetic, talkative, bold,
active, assertive, and adventurous}."
Results Analysis
- Model

- LLM Personality Characterization Results

- the median level of **BFI** subscales (*EXT*, *AGR*, *CON*, *OPE*) increased as the model size increased
- the median level of **BFI** *NEU* decreased with larger model sizes
- the distributions of **IPIP-NEO** scores remained relatively stable across different sizes, except for *EXT* and *CON* which increases as the model size increased
Construct Validation Results

LLM-simulated psychometric data are most human-aligned for Flan-PaLM 540B (the largest model)- Structural Validation Results

- Structural Validation Results
2023-08-10
Title: Jailbroken: How Does LLM Safety Training Fail? (arXiv 2023)
Author: Alexander Wei, Nika Haghtalab, Jacob Steinhardt
Summary:

