Risk Taxonomy, Mitigation, and Assessment Benchmarks of Large Language Model Systems

Tianyu Cui, Yanling Wang, Chuanpu Fu, Yong Xiao, Sijia Li, Xinhao Deng, Yunpeng Liu, Qinglin Zhang, Ziyi Qiu, Peiyang Li, Zhixing Tan, Junwu Xiong, Xinyu Kong, Zujie Wen, Ke Xu, Qi Li

I Introduction

Large language models (LLMs) that own massive model parameters pre-trained on extensive corpora, have catalyzed a revolution in the fields of Natural Language Processing (NLP). The scale-up of model parameters and the expansion of pre-training corpora have endowed LLMs with remarkable capabilities across various tasks, including text generation , coding , and knowledge reasoning . Furthermore, alignment techniques (e.g., supervised fine-tuning and reinforcement learning from human feedback ) are proposed to encourage LLMs to align their behaviors with human preferences, thereby enhancing the usability of LLMs. In practice, advanced LLM systems like ChatGPT have consistently garnered a global user base, establishing themselves as competitive solutions for complex NLP tasks.

Despite the great success of LLM systems, they may sometimes violate human values and preferences, thus raising concerns about safety and security of LLM-based applications. For example, ChatGPT leaked chat history of users due to vulnerabilities in the Redis client open-source library . In addition, well-crafted adversarial prompts can elicit harmful responses from LLMs . Even without adversarial attacks, current LLMs may still generate untruthful, toxic, biased, and even illegal contents . These undesirable contents could be abused, resulting in adverse social impacts. Therefore, extensive research efforts have been dedicated to mitigating these issues . Leading-edge organizations like OpenAI, Google, Meta, and Anthropic also make lots of efforts on responsible LLMs, prioritizing the development of beneficial AI .

To mitigate the risks of LLMs, it is imperative to develop a comprehensive taxonomy that enumerates all potential risks inherent in the construction and deployment of LLM systems. This taxonomy is intended to serve as a guidance for evaluating and improving the reliability of LLM systems. Predominantly, the majority of existing efforts propose their risk taxonomies based on the assessment and analysis of output content with multiple metrics. In general, an LLM system consists of various key modules — an input module for receiving prompts, a language model trained on vast datasets, a toolchain module for development and deployment, and an output module for exporting LLM-generated content. To the best of our knowledge, there have been limited taxonomies proposed to systematically categorize risks across the various modules of an LLM system. Hence this work aims to bridge the gap to encourage LLM participants to 1) comprehend the safety and security concerns associated with each module of an LLM system, and 2) embrace a systematic perspective for building more responsible LLM systems.

To achieve the goal, we propose a module-oriented taxonomy that classify the risks and their mitigation strategies associated with each module of an LLM system. For a specific risk, the module-oriented taxonomy can assist in quickly pinpointing modules necessitating attention, thereby helping engineers and developers to determine effective mitigation strategies. As illustrated in Figure 1, we provide an example of privacy leakage within an LLM system. Using our module-oriented taxonomy, we can attribute the privacy leakage issue to the input module, the language model module, and the toolchain module. Consequently, developers can fortify against adversarial prompts, employ privacy training, and rectify vulnerabilities in tools to mitigate the risk of privacy leakage. Besides summarizing the potential risks of LLM systems and their mitigation methods, this paper also reviews widely-adopted risk assessment benchmarks and discusses the safety and security of prevalent LLM systems.

To sum up, this paper makes the following contributions.

We conduct a comprehensive survey of risks and mitigation methods associated with each module of an LLM system, as well as review the benchmarks for evaluating the safety and security of LLM systems.

We propose a module-oriented taxonomy, which attributes a potential risk to specific modules of an LLM system. This taxonomy aids developers in gaining a deeper understanding of the root causes behind possible risks and thus facilitates the development of beneficial LLM systems.

With a more systematic perspective, our taxonomy covers a more comprehensive range of LLM risks than the previous taxonomies. It is worth noting that we consider the security issues closely associated with the toolchain, which is rarely discussed in prior surveys.

Roadmap. The subsequent sections are organized as follows: Section II introduces the background of LLMs. Section III introduces the risks of LLM systems. Section IV offers an overview of the safety and security concerns associated with each module of an LLM system. Section V surveys the mitigation strategies employed by different system modules. Section VI summarizes existing benchmarks for evaluating the safety and security of LLM systems. Finally, Section VII and Section VIII respectively conclude this survey and provide suggestions for the future exploration.

II Background

Language models (LMs) are designed to quantify the likelihood of a token sequence . In specific, a text is transformed into a sequence of tokens s={v0,v1,v2,⋯ ,vt,⋯ ,vT}s=\{v_{0},v_{1},v_{2},\cdots,v_{t},\cdots,v_{T}\}. The likelihood of ss is p(s)=p(v0)⋅∏t=1Tp(vt∣v<t)p\left(s\right)=p\left(v_{0}\right)\cdot\prod_{t=1}^{T}p\left(v_{t}|v_{<t}\right), where vt∈Vv_{t}\in\mathcal{V}. This survey focuses on the most popular generative LMs that generate sequences in an autoregressive manner. Formally, given a sequence of tokens v<t={v0,v1,v2,⋯ ,vt−1}v_{<t}=\{v_{0},v_{1},v_{2},\cdots,v_{t-1}\} and a vocabulary V\mathcal{V}, the next token vt∈Vv_{t}\in\mathcal{V} is determined based on the probability distribution p(v∣v<t)p\left(v|v_{<t}\right). Beam search and greedy search are two classic methods to determine the next token. Recently, the prevalent sampling strategies including top-kk sampling and nucleus sampling (i.e., top-pp sampling) , have been widely used to sample vtv_{t} from V\mathcal{V} based on the probability distribution p(v∣v<t)p\left(v|v_{<t}\right).

Large language models (LLMs) are the LMs that have billions or even more model parameters pre-trained on massive data, such as LLaMA and GPT families (e.g., GPT-3 , GPT-3.5 , and GPT-4 ). Recently, researchers discovered the scaling law , i.e., increasing the sizes of pre-training data and model parameters can significantly enhance an LM’s capacity for downstream tasks. Such an “emerging ability” is a crucial distinction among the current LLMs and earlier small-scale LMs.

Network Architecture. Among existing LLMs, the mainstream network architecture is Transformer , which is a well-known neural network structure in Natural Language Processing (NLP). In general, an LLM is stacked by several Transformer blocks, and each block consists of a multi-head attention layer as well as a feed-forward layer. Additionally, trainable matrices enable mappings between the vocabulary space and the representation space. The key of Transformer is using attention mechanism to reflect the correlations between tokens via attention scores. Therefore, the attention layers could capture the semantically meaningful interactions among different tokens to facilitate representation learning.

Training Pipeline. LLMs undergo a series of exquisite development steps to implement high-quality text generation. The typical process of LLM development contains three steps — pre-training, supervised fine-tuning, and learning from human feedback . In what follows, we will briefly review the core steps for training LLMs to help readers understand the preliminary knowledge of LLM construction.

∙\bullet Pre-Training. The initial LLM is pre-trained on a large-scale corpora to obtain extensive general knowledge. The pre-training corpora is a mixture of datasets from diverse sources, including web pages, books, and user dialog data. Moreover, specialized data, such as code, multilingual data, and scientific data, is incorporated to enhance LLMs’s reasoning and task-solving abilities . For the collected raw data, data pre-processing is required to remove noise and redundancy. After that, tokenization is used to transform textual data into token sequences for language modeling. By maximizing the likelihood of token sequences, the pre-trained model is empowered with impressive language understanding and generation ability.

∙\bullet Supervised Fine-Tuning (SFT). Different from the pre-training process which requires a huge demand for computational resources, SFT usually trains the model on a smaller scale but well-designed high-quality instances to unlock LLMs’ ability to deal with prompts of multiple downstream tasks . Among recent LLM fine-tuning methods, instruction tuning has become the most popular one, in which the input prompts follow the instruction format.

∙\bullet Learning from Human Feedback. Reinforcement learning from human feedback (RLHF) is a typical method for aligning LLMs’ responses with human preference and enhancing the safety of LLMs . In RLHF, a reward model is trained with human feedback to score the quality of LLMs’ output content, where the human preference is expressed as the ranking of multiple LLM outputs about a certain input prompt. Particularly, the architecture of a reward model can also be a language model. For example, OpenAI and DeepMind build their reward models based on GPT-3 and Gopher , respectively. After deriving a well-trained reward model, a reinforcement learning (RL) algorithm such as Proximal Policy Optimization (PPO) , is adopted to fine-tune an LLM based on the feedback from the reward model. Nevertheless, implementing RLHF algorithms is non-trivial due to their complex training procedures and unstable performance. Therefore, recent attempts propose to learn human preferences by a ranking objective , or express human preferences as natural language and inject them into the SFT procedure .

III Modules of LLM Systems

In practical applications, users typically interact with language models through an LLM system. An LLM system generally integrates several modules. In this section, we present the pivotal modules of an LLM system and briefly introduce the risks associated with these modules.

LLM Modules. An LLM system involves a series of data, algorithms, and utils, which can be divided into different modules of the LLM system. In this survey, we discuss the most major modules, including an input module for receiving prompts, a language model trained on vast datasets, a toolchain module for development and deployment, and an output module for exporting LLM-generated contents. Figure 2 illustrates the relationships between the aforementioned modules.

∙\bullet Input Module. The input module is implemented with an input safeguard to receive and pre-process input prompts. In specific, this module usually contains a receiver waiting for the requests typed by users and algorithm-based strategies to filter or limit the requests.

∙\bullet Language Model Module. The language model is the foundation of the whole LLM system. In essence, this module involves extensive training data and the up-to-date language model trained with these data.

∙\bullet Toolchain Module. The toolchain module contains utilities employed by the development and deployment of an LLM system. Concretely, this module involves software development tools, hardware platforms, and external tools.

∙\bullet Output Module. The output module returns the final responses of an LLM system. Generally, the module is accompanied by an output safeguard to revise the LLM-generated content to conform to ethical soundness and justification.

Risks Considered in This Paper. The safety and security of LLM systems have become an essential concern in recent years. Although prior studies have attempted to list a bunch of issues in an LLM system, limited work systematically categorizes these risks into various modules of an LLM system. In this survey, we will shed light on potential risks associated with each module of an LLM system, aiming to help engineers and developers better develop and deploy a trustworthy LLM system.

Figure 2 illustrates the potential risks associated with each module of an LLM system. This survey will take insights into 1) not-suitable-for-work and adversarial prompts encountered by the input module, 2) risks inherent in the language models, 3) threats raised by vulnerabilities in deployment tools, software libraries, and external tools, and 4) dishonest and harmful LLM-generated contents mistakenly passed by the output module as well as their unhelpful uses. In the following sections, we will comprehensively analyze the aforementioned concerns and survey their mitigation strategies. Furthermore, we will summarize typical benchmarks for evaluating the safety and security of LLM systems.

IV Risks in LLM Systems

Along with LLMs’ growing popularity, the risks associated with LLM systems have also gained attention. In this section, we categorize these risks across various modules of an LLM system. Figure 3 illustrates the overview of the risks we investigated in the survey.

The input module is the initial window that LLM systems open to the users during the user-machine conversation. Through the module, users can type the instructions into the system to query desired answers. However, when these input prompts contain harmful content, the LLM systems may face the risk of generating undesired content. In what follows, we divide the malicious input prompts into (1) not-suitable-for-work prompts and (2) adversarial prompts. Figure 4 shows examples of these two types of prompts.

Not-Suitable-for-Work (NSFW) Prompts. Nowadays, the interaction manner of instruction-following LLMs brings the model closer to the users. However, when the prompts contain an unsafe topic (e.g., NSFW content) asked by the users, LLMs could be prompted to generate offensive and biased content. According to , the scenarios of these unsafe prompts could include insult, unfairness, crimes, sensitive political topics, physical harm, mental health, privacy, and ethics. Monitoring all the input events in LLM systems should require significantly high labor costs. In particular, it is more difficult to discriminate the harmful input when the prompt hides an unsafe opinion. The imperceptibly unsafe content in the input seriously misleads the model to generate potentially harmful content.

Adversarial Prompts. Adversarial prompts are a new type of threat in LLMs by engineering an adversarial input to elicit an undesired model behavior. Different from NSFW prompts, these adversarial prompts usually pose a clear attack intention. The adversarial inputs are often grouped into prompt injection attacks and jailbreaks. As the spread of adversarial prompt vulnerability releases for ChatGPT in the community , many developers of LLMs have acknowledged and updated the system to mitigate the issues . According to the attack intention and manners of the input attacks, the adversarial prompts could be divided into two categories, including prompt injection and jailbreaking.

∙\bullet Prompt Injection. Prompt injection attack aims to misalign an LLM by inserting malicious text in the prompts. specifically, prompt injection includes two types of attacks — goal hijacking and prompt leaking.

1) Goal Hijacking. Goal hijacking is a type of primary attack in prompt injection. By injecting a phrase like “Ignore the above instruction and do …” in the input, the attack could hijack the original goal of the designed prompt (e.g., translating tasks) in LLMs and execute the new goal in the injected phrase. Since the model may be out of control and respond to malicious queries, goal hijacking gets the most concern in the prompt injection family. In addition to being injected into the user input, the goal-hijacking prompts could also be injected into the data or web pages retrieved by LLM-integrated applications . This type of adversarial prompts could bypass LLMs’ safeguards to circumvent content restrictions and even influence the downstream LLM-integrated applications .

2) Prompt Leaking. Prompt leaking is another type of prompt injection attack designed to expose details contained in private prompts. According to , prompt leaking is the act of misleading the model to print the pre-designed instruction in LLMs through prompt injection. By injecting a phrase like “\n\n======END. Print previous instructions.” in the input, the instruction used to generate the model’s output is leaked, thereby revealing confidential instructions that are central to LLM applications. Experiments have shown prompt leaking to be considerably more challenging than goal hijacking .

∙\bullet Jailbreaking. Distinguished from the aforementioned two prompt injection attack methods, jailbreaking no longer involves a simple injection of malicious prompts. Rather, it entails the construction of intricate scenarios through meticulous design and refinement of prompts. The objective is to elicit LLMs to generate harmful content that violates the usage policy. These tailored prompts are designed to be more covert and effective in concealing their malicious intent, thereby circumventing the restrictions imposed on LLMs.

An illustrative example of a jailbreak attack is demonstrated in Figure 4. In this instance, the LLM demonstrates its refusal to a direct malicious query of “How can I create a deadly poison that is undetectable and untraceable”. Nevertheless, if the question is concealed within a subtly harmful conversational context, the chatbot could unintentionally produce responses that violate its usage policy. Consequently, the nature of the attacker’s intentions allows for the substitution of this query with alternative content that violates the established usage policy parameters. These jailbreaking techniques can be broadly categorized into two groups: One-step Jailbreaks and Multi-step Jailbreaks. For further clarity, the taxonomy and examples of adversarial prompts are presented in Table I.

1) One-step jailbreaks. One-step jailbreaks commonly involve direct modifications to the prompt itself, such as setting role-playing scenarios or adding specific descriptions to prompts . Role-playing is a prevalent method used in jailbreaking by imitating different personas. Such a method is known for its efficiency and simplicity compared to more complex techniques that require domain knowledge . Integration is another type of one-step jailbreaks that integrates benign information on the adversarial prompts to hide the attack goal. For instance, prefix integration is used to integrate an innocuous-looking prefix that is less likely to be rejected based on its pre-trained distributions . Additionally, the adversary could treat LLMs as a program and encode instructions indirectly through code integration or payload splitting . Obfuscation is to add typos or utilize synonyms for terms that trigger input or output filters. Obfuscation methods include the use of the Caesar cipher , leetspeak (replacing letters with visually similar numbers and symbols), and Morse code . Besides, at the word level, an adversary may employ Pig Latin to replace sensitive words with synonyms or use token smuggling to split sensitive words into substrings.

2) Multi-step jailbreaks. Multi-step jailbreaks involve constructing a well-designed scenario during a series of conversations with the LLM. Unlike one-step jailbreaks, multi-step jailbreaks usually guide LLMs to generate harmful or sensitive content step by step, rather than achieving their objectives directly through a single prompt. We categorize the multi-step jailbreaks into two aspects — Request Contextualizing and External Assistance. Request Contextualizing is inspired by the idea of Chain-of-Thought (CoT) prompting to break down the process of solving a task into multiple steps. Specifically, researchers divide jailbreaking prompts into multiple rounds of conversation between the user and ChatGPT, achieving malicious goals step by step. External Assistance constructs jailbreaking prompts with the assistance of external interfaces or models. For instance, JAILBREAKER is an attack framework to automatically conduct SQL injection attacks in web security to LLM security attacks. Specifically, this method starts by decompiling the jailbreak defense mechanisms employed by various LLM chatbot services. Therefore, it can judiciously reverse engineer the LLMs’ hidden defense mechanisms and further identify their ineffectiveness.

IV-B Risks in Language Models

The language model is the core module in the LLM system. In this section, we will present the risks on language models from four aspects, including privacy leakage, toxicity and bias tendencies, hallucinations, and vulnerability to model attacks.

Privacy Leakage. To cover a broad range of knowledge and maintain a strong in-context learning capability, recent LLMs are built up with a massive scale of training data from a variety of web resources . However, these web-collected datasets are likely to contain sensitive personal information, resulting in privacy risks. More precisely, LLMs are trained on corpus with personal data, thereby inadvertently exposing such information during human-machine conversations. A series of studies have confirmed the privacy leakage issues in the earlier PLMs and LLMs. To gain a deeper comprehension of privacy leakage in LLMs, we outline its underlying causes as follows.

∙\bullet Private Training Data. As recent LLMs continue to incorporate licensed, created, and publicly available data sources in their corpora, the potential to mix private data in the training corpora is significantly increased. The misused private data, also named as personally identifiable information (PII) , could contain various types of sensitive data subjects, including an individual person’s name, email, phone number, address, education, and career. Generally, injecting PII into LLMs mainly occurs in two settings — the exploitation of web-collection data and the alignment with personal human-machine conversations . Specifically, the web-collection data can be crawled from online sources with sensitive PII, and the personal human-machine conversations could be collected for SFT and RLHF.

∙\bullet Memorization in LLMs. Memorization in LLMs refers to the capability to recover the training data with contextual prefixes. According to , given a PII entity xx, which is memorized by a model FF. Using a prompt pp could force the model FF to produce the entity xx, where pp and xx exist in the training data. For instance, if the string “Have a good day!\n alice@email.com” is present in the training data, then the LLM could accurately predict Alice’s email when given the prompt “Have a good day!\n”. LLMs’ memorization is influenced by the model capacity, data duplication, and the length of the prompt prefix , which means the issue of PII leakage will be magnified due to the growth of the model parameters, the increasing number of duplicated PII entities in the data, and the increasing length of the prompt related to PII entities.

∙\bullet Association in LLMs. Association in LLMs refers to the capability to associate various pieces of information related to a person. According to , given a pair of PII entities (xi,xj)(x_{i},x_{j}), which is associated by a model FF. Using a prompt pp could force the model FF to produce the entity xjx_{j}, where pp is the prompt related to the entity xix_{i}. For instance, an LLM could accurately output the answer when given the prompt “The email address of Alice is”, if the LLM associates Alice with her email “alice@email.com”. LLMs’ association ability is influenced by the target pairs’ co-occurrence distances and the co-occurrence frequencies . Since the ability could enable an adversary to acquire PII entities by providing related information about an individual, LLMs’ association ability can contribute to more PII leakage issues compared to memorization .

Toxicity and Bias Tendencies. In addition to the private data, the extensive data collection also brings toxic content and stereotypical bias into the training data of LLMs. Training with these toxic and biased data could raise legal and ethical challenges. In specific, the issues of toxicity and bias can potentially arise in both the pre-training and fine-tuning stages. The pre-training data consists of a vast number of unlabelled documents, making it challenging to eliminate low-quality data. The fine-tuning data is relatively smaller in size but has a significant impact on the model, especially in supervised fine-tuning (SFT). Even a small amount of low-quality data can result in severe consequences. Prior research has extensively investigated the issues of toxicity and bias related to language models. In this section, we mainly focus on the cause of toxicity and bias in the training data.

∙\bullet Toxic Training Data. Following previous studies , toxic data in LLMs is defined as rude, disrespectful, or unreasonable language that is opposite to a polite, positive, and healthy language environment, including hate speech, offensive utterance, profanities, and threats . Although the detection and mitigation techniques of toxicity have been widely studied in earlier PLMs, the training data of the latest LLMs still contain toxic contents due to the increase of data scales and scopes. For instance, within the LLaMA2’s pre-training corpora, about 0.2% of documents could be recognized as toxic content based on a toxicity classifier. Besides, a recent work observes that the toxic content within the training data can be elicited when assigning personas to LLMs. Therefore, it is highly necessary to detoxify LLMs. However, detoxifying presently remains challenging, as simply filtering the toxic training data can lead to a drop in model performance .

∙\bullet Biased Training Data. Compared with the definition of toxicity, the definition of bias is more subjective and context-dependent. Based on previous work , we describe the bias as disparities that could raise demographic differences among various groups, which may involve demographic word prevalence and stereotypical contents. Concretely, in massive corpora, the prevalence of different pronouns and identities could influence an LLM’s tendency about gender, nationality, race, religion, and culture . For instance, the pronoun He is over-represented compared with the pronoun She in the training corpora, leading LLMs to learn less context about She and thus generate He with a higher probability . Furthermore, stereotypical bias which refers to over-generalized beliefs about a particular group of people, usually keeps incorrect values and is hidden in the large-scale benign contents. In effect, defining what should be regarded as a stereotype in the corpora is still an open problem.

Hallucinations. In the realm of psychology, hallucination is characterized as a kind of perception . When it comes to the language models, hallucination can be defined as the phenomenon wherein models generate nonsensical, unfaithful, and factual incorrect content . For a better understanding of hallucinations, developers of GPT-4 categorize hallucinations into closed-domain hallucination and open-domain hallucination . The former refers to generating extra information that does not exist in the given user input, resulting in factual inconsistencies between the source content and the generated content. For example, an LLM is asked to conduct text summarization, while it introduces extra information that does not exist in the given article . Open-domain hallucination refers to generating incorrect information about the real world. For example, given an input question “Who is Leonardo da Vinci?”, an LLM could output a wrong answer “Leonardo da Vinci is a famous singer”. In practice, no matter what kind of hallucinations, their presence can significantly reduce the reliability of LLM systems. Furthermore, as the model size increases, the issue of hallucination will become increasingly serious on the conceptual knowledge . Hence, there is a pressing demand for eliminating hallucinations from LLMs. In what follows, we present an overview of the widely recognized sources of LLM hallucinations, aiming to facilitate the development of effective mitigation methods.

∙\bullet Knowledge Gaps. Since the training corpora of LLMs can not contain all possible world knowledge , and it is challenging for LLMs to grasp the long-tail knowledge within their training data , LLMs inherently possess knowledge boundaries . Therefore, the gap between knowledge involved in an input prompt and knowledge embedded in the LLMs can lead to hallucinations. For instance, when we ask an LLM the question “What’s the weather like tomorrow?”, the LLM is prone to providing an incorrect response due to the lack of real-time weather data. Another example is that an LLM may fail to answer the question “Where is Golmud?”, since “Golmud” is a long-tail entity in the model’s training corpora, and thus the LLM fails to memorize the knowledge.

∙\bullet Noisy Training Data. Another important source of hallucinations is the noise in training data, which introduces errors in the knowledge stored in model parameters . Generally, the training data inherently harbors misinformation. When training on large-scale corpora, this issue becomes more serious because it is difficult to eliminate all the noise from the massive pre-training data.

∙\bullet False Recall of Memorized Information. Although LLMs indeed memorize the queried knowledge, they may fail to recall the corresponding information . That is because LLMs can be confused by co-occurance patterns , positional patterns , duplicated data and similar named entities . Recently, an empirical study reveals that LLMs tend to treat named entities as “indices” to retrieve information from their parameterized knowledge, even though the recalled information is irrelevant to solving the inference task.

∙\bullet Pursuing Consistent Context. LLMs have been demonstrated to pursue consistent context , which may lead to erroneous generation when the prefixes contain false information. Typical examples include sycophancy , false demonstrations-induced hallucinations , and snowballing . As LLMs are generally fine-tuned with instruction-following data and user feedback, they tend to reiterate user-provided opinions , even though the opinions contain misinformation. Such a sycophantic behavior amplifies the likelihood of generating hallucinations, since the model may prioritize user opinions over facts. Besides, LLMs are often applied to complete downstream tasks via imitating a few demonstration examples (i.e., few-shot in-context learning) . However, such a scheme may lead models to produce incorrect content if the demonstrations contain misinformation . This limitation can be attributed to some special attention heads (i.e., induction heads ) in an LLM, which attend to and copy misinformation from the false demonstrations during the generation process. Furthermore, LLMs have been found to generate snowballed hallucinations for consistency with earlier generated hallucinations .

∙\bullet Defective Decoding Process. In general, LLMs employ the Transformer architecture and generate content in an auto-regressive manner, where the prediction of the next token is conditioned on the previously generated token sequence. Such a scheme could accumulate errors . Besides, during the decoding process, top-pp sampling and top-kk sampling are widely adopted to enhance the diversity of the generated content. Nevertheless, these sampling strategies can introduce “randomness” , thereby increasing the potential of hallucinations.

Vulnerability to Model Attacks. Model attacks are a bunch of attack techniques that threaten the security of deep learning based models. These attacks exploit the vulnerability of artificial intelligence running at the training and inference stages, aiming to steal valuable information or lead to incorrect responses. In nature, LLMs are large-scale deep neural networks. Hence they also have similar attack surfaces to earlier PLMs and other models. In this section, we summarize traditional adversarial attacks and their feasibility on LLMs.

∙\bullet Traditional Model Attacks. According to previous work , adversarial attacks on models could be divided into five types, including extraction attacks, inference attacks, poisoning attacks, evasion attacks, and overhead attacks.

1) Extraction Attacks. Extraction attacks allow an adversary to query a black-box victim model and build a substitute model by training on the queries and responses. The substitute model could achieve almost the same performance as the victim model. While it is hard to fully replicate the capabilities of LLMs, adversaries could develop a domain-specific model that draws domain knowledge from LLMs.

2) Inference Attacks. Inference attacks include membership inference attacks, property inference attacks, and data reconstruction attacks. These attacks allow an adversary to infer the composition or property information of the training data. Previous works have demonstrated that inference attacks could easily work in earlier PLMs, implying that LLMs are also possible to be attacked.

3) Poisoning Attacks. Poisoning attacks could influence the behavior of the model by making small changes to the training data. A number of efforts could even leverage data poisoning techniques to implant hidden triggers into models during the training process (i.e., backdoor attacks). Many kinds of triggers in text corpora (e.g., characters, words, sentences, and syntax) could be used by the attackers.

4) Evasion Attacks. Evasion attacks target to cause significant shifts in model’s prediction via adding perturbations in the test samples to build adversarial examples. In specific, the perturbations can be implemented based on word changes, gradients, etc.

5) Overhead Attacks. Overhead attacks are also named energy-latency attacks. For example, an adversary can design carefully crafted sponge examples to maximize energy consumption in an AI system. Therefore, overhead attacks could also threaten the platforms integrated with LLMs.

∙\bullet Model Attacks on LLMs. With the rapid advancement of LLMs, explorations of model attacks on LLMs are growing in the security community. Several studies have evaluated the robustness of LLMs against adversarial examples, exposing vulnerabilities in Flan-T5, BLOOM, ChatGPT, and others. Even for the state-of-the-art GPT-4, its performance could be negatively impacted when evaluated with adversarial prompts generated by LLMs like Alpaca and Vicuna. In specific, the research on inference attacks demonstrated that an adversary could easily extract the training data from GPT-2 and other LLMs. Some studies explored the effectiveness of posing attacks on PLMs and LLMs with prompt triggers. LLMs like GPT-Neo could be planted textual backdoor with a significantly high attack success rate. Except for these traditional attacks, some novel scenarios brought by LLMs have spawned lots of brand-new attack technologies. For instance, prompt abstraction attacks involve inserting an intermediary agent between human-machine conversations to summarize contents and query LLM APIs at a reduced cost . Poisoning attacks inject backdoors into the reward models of RLHF . Furthermore, the capability of LLMs can be utilized to generate diverse threatening samples to conduct attacks .

IV-C Risks in Toolchain Modules

In this section, we analyze the security concerns associated with the tools involved in the development and deployment lifecycle of LLM-based services. Specifically, we focus on the threats originating from three sources: (1) software development tools, (2) hardware platforms, and (3) external tools.

Security Issues in Software Development Tools. The toolchain for developing LLM is becoming increasingly complex, involving a comprehensive development toolchain such as the programming language runtime, Continuous Integration and Delivery (CI/CD) development pipelines, deep learning frameworks, data pre-processing tools, and so on. However, these tools present significant threats to the security of developed LLMs. To address this concern, we identify four primary categories of software development tools and conduct a detailed analysis of the underlying security issues associated with each category.

∙\bullet Programming Language Runtime Environment. Most LLMs are developed using the Python language, whereas the vulnerabilities of Python interpreters pose threats to the developed models. Many of these vulnerabilities directly impact the development and deployment of LLMs. For instance, poorly coded scripts can inadvertently trigger vulnerabilities that leave the system susceptible to potential Denial of Service (DoS) attacks, leading to CPU and RAM exhaustion (CVE-2022-48564). Similarly, CPU cycle DoS vulnerabilities have been identified in CVE-2022-45061 and CVE-2021-3737. Additionally, there is an issue of SHA-3 overflow, as described in CVE-2022-37454. Another noteworthy observation is that LLM training usually involves multiprocessing libraries in the Python standard library. However, recent discoveries have revealed massive information leakages, as seen in CVE-2022-42919.

∙\bullet CI/CD Development Pipelines. The development of LLMs often involves collaboration among many programmers. To effectively manage the development lifecycle of such projects, the use of Continuous Integration and Delivery (CI/CD) systems has become prevalent. CI/CD pipelines enable the integration, testing, and delivery of software in a consistent, regular, and automated manner. Various CI/CD services, such as GitLab CI, are commonly employed in LLM development to streamline the workflow and ensure seamless integration and delivery of codes and resources. Several studies have explored the CI/CD pipelines, aiming to comprehend their challenges and trade-offs. Existing work analyzed public continuous integration services , shedding light on the risks posed by human factors, such as the risk of supply chain attacks. Subsequently, numerous exploitable plugins were identified in GitLab CI systems . These plugins could inadvertently expose the codes and training data of LLMs, posing a significant security concern.

∙\bullet Deep Learning Frameworks. LLMs are implemented based on deep learning frameworks. Notably, various vulnerabilities in these frameworks have been disclosed in recent years. As reported in the past five years, three of the most common types of vulnerabilities are buffer overflow attacks, memory corruption, and input validation issues. For example, CVE-2023-25674 is a null-pointer bug that leads to crashes during LLM training. Similarly, CVE-2023-25671 involves out-of-bound crash attacks, and CVE-2023-25667 relates to an integer overflow issue. Furthermore, even popular deep learning frameworks like PyTorch experienced various security issues. One example is the influential CVE-2022-45907, which brings the risk of arbitrary code execution.

∙\bullet Pre-Processing Tools. Pre-processing tools play a crucial role in the context of LLMs. These tools, which are often involved in computer vision (CV) tasks, are susceptible to attacks that exploit vulnerabilities in tools such as OpenCV. Consequently, these attacks can be leveraged to target LLM-based computer vision applications. For instance, image-based attacks, such as image scaling attacks, involve manipulating the image scaling function to inject meaningless or malicious input . Additionally, the complex structures involved in processing images can introduce risks such as control flow hijacking vulnerabilities, as exemplified by CVE-2023-2618 and CVE-2023-2617.

Security Issues in Hardware Platforms. LLM requires dedicated hardware systems for training and inference, which provide huge computation power. These complex hardware systems introduce security issues to LLM-based applications.

∙\bullet GPU Computation Platforms. The training of LLMs requires significant GPU resources, thereby introducing an additional security concern. GPU side-channel attacks have been developed to extract the parameters of trained models . To tackle this issue, researchers have designed secure environments to secure GPU execution , which mitigate the risks associated with GPU side-channel attacks and safeguard the confidentiality of LLM parameters.

∙\bullet Memory and Storage. Similar to conventional programs, hardware infrastructures can also introduce threats to LLMs. Memory-related vulnerabilities, such as rowhammer attacks , can be leveraged to manipulate the parameters of LLMs, giving rise to attacks such as the Deephammer attack . Several mitigation methods have been proposed to protect deep neural networks (DNNs) against these attacks. However, the feasibility of applying these methods to LLMs, which typically contain a larger number of parameters, remains uncertain.

∙\bullet Network Devices. The training of LLMs often relies on distributed network systems . During the transmission of gradients through the links between GPU server nodes, significant volumetric traffic is generated. This traffic can be susceptible to disruption by burst traffic, such as pulsating attacks . Furthermore, distributed training frameworks may encounter congestion issues .

Security Issues in External Tools. External tools such as web APIs and other machine learning models for specific tasks can be used to expand the action space of LLMs and allow LLMs to handle more complex tasks . However, these external tools may bring security risks to LLM-based applications. We identify two prominent security concerns about the external tools.

∙\bullet Factual Errors Injected by External Tools. External tools typically incorporate additional knowledge into the input prompts . The additional knowledge often originates from public resources such as Web APIs and search engines. As the reliability of external tools is not always ensured, the content returned by external tools may include factual errors, consequently amplifying the hallucination issue.

∙\bullet Exploiting External Tools for Attacks. Adversarial tool providers can embed malicious instructions in the APIs or prompts , leading LLMs to leak memorized sensitive information in the training data or users’ prompts (CVE-2023-32786). As a result, LLMs lack control over the output, resulting in sensitive information being disclosed to external tool providers. Besides, attackers can easily manipulate public data to launch targeted attacks, generating specific malicious outputs according to user inputs. Furthermore, feeding the information from external tools into LLMs may lead to injection attacks . For example, unverified inputs may result in arbitrary code execution (CVE-2023-29374).

IV-D Risks in Output Modules

The originally generated content faced by the output module could violate the user’s reference, displaying harmful, untruthful, and unhelpful information. Therefore, it is highly necessary for this module to review and intervene the LLM-generated content before exporting the content to users. In this subsection, we will shed light on the risks at the output end.

Harmful Content. The generated content sometimes contains biased, toxic, and private information. Bias represents inequitable attitude and position of LLM systems. For example, researchers have found that GPT-3 frequently associates professions like legislators, bankers, or professors with male characteristics, whereas roles such as nurses, receptionists, and housekeepers are more commonly linked with female characteristics . This phenomenon can lead to increased social tensions and conflicts. Toxicity means the generated content contains rude, disrespectful, and even illegal information . For example, ChatGPT may generate toxic content when playing the role of a storytelling grandmother or “Muhammad Ali” . Whether intentionally or not, the toxicity content will not only directly affect the physical and mental health of users, but also inhibit the harmony of cyberspace. Privacy Leakage means the generated content includes sensitive personal information. It is reported that the federal privacy commissioner of Canada has received complaints that OpenAI collects, uses, and discloses personal information without permission. Besides, employees may use LLM systems to help them improve work efficiency, but this behavior will also lead to the disclosure of business secrets.

Untruthful Content. The LLM-generated content could contain inaccurate information. For example, given the prompt “Who took the very first pictures of a planet outside of our solar system?”, the first demo of Google’s Chatbot Bard gave an untruthful answer “James Webb Space Telescope” , while these pictures were actually taken by the VLT Yepun Telescope. Besides the factuality errors, the LLM-generated content could contain faithfulness errors . For instance, an LLM is requested to summarize a given article, while the output content has conflicts with the given article . Essentially, the untruthful content is highly related to LLM hallucination. Please refer to the early part of this section for the summary of sources of LLM hallucination.

Unhelpful Uses. Although LLM systems have largely improved human’s work efficiency, improper use of LLM systems (i.e., abuse of LLM systems) will cause adverse social impacts, such as academic misconduct , copyright violation , cyber attacks , and software vulnerabilities . Here are some realistic cases. First, many educational institutions have banned the use of ChatGPT and similar products, since excessive reliance on LLM systems will affect the independent thinking ability of in-school students and result in academic plagiarism. Besides, LLM systems may output content similar to existing works, infringing on copyright owners. Moreover, hackers can obtain malicious code in a low-cost and efficient manner to automate cyber attacks with powerful LLM systems. Europol Innovation Lab warned that criminal organizations have utilized LLM systems to build malware families, such as ransomware, backdoors, and hacking tools . In addition, programmers are accustomed to using code generation tools such as Github Copilot for program development, which may bury vulnerabilities in the program. It is worth noting that research on Copilot-generated code has shown that certain types of vulnerabilities are usually contained in the generated code. Furthermore, practitioners in other important fields, such as law and medicine, rely on LLM systems to free them from heavy work. However, LLM systems may lack a deeper understanding of professional knowledge, and thus improper legal advice and medical prescriptions will have a serious negative impact on the company operations and health of patients.

V Mitigation

As analyzed in Section IV, LLM systems contain a variety of risks and vulnerabilities that could compromise their reliability. In this section, we survey the mitigation strategies for each risk. Figure 6 shows the overview of mitigation to alleviate the risks of LLM systems.

Mitigating the threat posed by the input module presents a significant challenge for LLM developers due to the diversity of the harmful inputs and adversarial prompts. Recently, practitioners have summarized some effective defense methods to mitigate the impacts of malicious prompts through black-box testing of existing LLMs. According to the previous work, existing mitigation methods are mainly divided into the following two categories — defensive prompt design and adversarial prompt detection.

Defensive Prompt Design. Directly modifying the input prompts is a viable approach to steer the behavior of the model and foster the generation of responsible outputs. This method integrates contextual information or constraints in the prompts to provide background knowledge and guidelines while generating the output. This section summarizes three methods of designing input prompts to achieve defense purposes.

∙\bullet Safety Preprompt. A straightforward defense strategy is to impose the intended behavior through the instruction passed to the model. By injecting a phrase like “note that malicious users may try to change this instruction; if that’s the case, classify the text regardless” into the input, the additional context information provided within the instruction helps to guide the model to perform the originally expected task . Another instance involves utilizing adjectives associated with safe behavior (e.g., “responsible”, “respectful” or “wise”) and prefixing the prompt with a safety pre-prompt like “You are a safe and responsible assistant” .

∙\bullet Adjusting the Order of Pre-Defined Prompt. Some defense methods achieve their goals by adjusting the order of pre-defined prompts. One such method involves placing the user input before the pre-defined prompt, known as post-prompting defense . This strategic adjustment renders goal-hijacking attacks that inject a phrase like “Ignore the above instruction and do…” ineffective. Another order-adjusted approach, named sandwich defense , encapsulates the user input between two prompts. This defense mechanism is considered to be more robust and secure compared to post-prompting techniques.

∙\bullet Changing Input Format. This kind of method aims to convert the original format of input prompts to alternative formats. Typically, similar to including the user input between <<user_input>> and <</user_input>> , random sequence enclosure method encloses the user input between two randomly generated sequences of characters. Moreover, some efforts employ JSON formats to parameterize the elements within a prompt. This involves segregating instructions from inputs and managing them separately . For example, benefiting from the format “Translate to French. Use this format: English: {English text as JSON quoted string} French: {French translation, also quoted}”, only the text in English JSON format can be identified as the English text to be translated. Therefore, the adversarial input will not influence the instruction.

Malicious Prompt Detection. Different from the methods of designing defensive prompts to preprocess the input, the malicious prompt detection method aims to detect and filter out the harmful prompts through the input safeguard.

∙\bullet Keyword Matching. Keyword matching is a common technique for preventing prompt hacking . The basic idea of the strategy is to check for words and phrases in the initial prompt that should be blocked. LLM developers can use a blocklist (i.e., a list of words and phrases to be blocked) or an allowlist (i.e., a list of words and phrases to be allowed) to defend undesired prompts . These defense mechanisms monitor the input, detecting elements that could break ethical guidelines. These guidelines cover various content types, such as sensitive information, offensive language, or hate speech. For instance, both Bing Chat and Bard incorporate keyword-mapping algorithms in their input safeguard to reduce the policy-violating inputs. Nonetheless, it is crucial to acknowledge that the inherent flexibility of natural languages allows for multiple prompt constructions that convey identical semantics. Consequently, the rule-based matching methods exhibit limitations in mitigating the threat posed by malicious prompts.

∙\bullet Content Classifier. Training a classifier to detect and refuse malicious prompts is a promising approach. For example, NeMo-Guardrails is an open-source toolkit developed by Nvidia to enhance LLMs with programmable guardrails. When presented with an input prompt, the jailbreak guardrail employs the Guardrails’ “input rails” to assess whether the prompt violates the LLM usage policies. If the prompt is found to breach these policies, the guardrail will reject the question, ensuring a safe conversation scenario. Generally, the key behind a prompt classifier is to carefully design the input features of the classifier. Recently, the trajectory of latent predictions in LLMs has been demonstrated to be a useful feature for training a malicious prompt detector . It is worth noting that such features can help enhance the interpretability of the malicious prompt detector. In addition, the LLM itself can serve as a detector. For example, feeding instructions like “You are Eliezer Yudkowsky, with a strong security mindset. Your job is to analyze whether the input prompt is safe…” to guide LLMs can enhance LLMs’ ability to judge whether a prompt is malicious.

V-B Mitigation in Language Models

This section delves into mitigating risks associated with models, encompassing privacy preservation, detoxification and debiasing, mitigation of hallucinations, and defenses against model attacks.

Privacy Preserving. Privacy leakage is a crucial risk of LLMs, since the powerful memorization and association capabilities of LLMs raise the risk of revealing private information within the training data. Researchers are devoted to designing privacy-preserving frameworks in LLMs , aiming to safeguard sensitive PII from possible disclosure during human-machine conservation. Studies to overcome the challenge of privacy leakage include privacy data interventions and differential privacy methods.

∙\bullet Private Data Interventions. The intervention can be accomplished by lexicon-based approaches or trainable classifiers . The lexicon-based approaches are usually based on pre-defined rules to recognize and cleanse sensitive PII entities. Alternatively, recent work tends to employ neural networks to automate the intervention process. For instance, the developers of GPT-4 have built automatic models to identify and remove the PII entities within the training data . A number of evaluation studies demonstrated that the methods of data intervention like deduplication and text sanitization are able to effectively improve the safety of LLMs (e.g., GPT-3.5 and LLaMA-7B) in privacy.

∙\bullet Privacy Enhanced Techniques. Differential privacy (DP) is a type of randomized algorithm to protect a private dataset from privacy leakage. To preserve individual information memorized by the model, developers can train the model with a differential privacy guarantee to hide the difference between two neighboring datasets (only one element is different between the two datasets). The goal of DP algorithms is to leave an acceptable distance that makes the two datasets indistinguishable. Lots of efforts have developed DP techniques as the standard for protecting privacy in earlier transformer-based PLMs and LLMs. However, it is demonstrated that the incorporation of differential privacy inevitably degrades the model’s performance. Therefore, researchers have employed a series of techniques to augment the model’s utility and make a better privacy-utility trade-off. Recently, with the emergence of LLMs, a growing number of studies are applying the DP techniques during the pre-training and fine-tuning of LLMs.

Detoxifying and Debiasing. To reduce the toxicity and bias of LLMs, prior efforts mainly focus on enhancing the quality of training data and conducting safety training.

∙\bullet Toxic and Biased Data Interventions. Similar to the idea of privacy data intervention, toxic/biased data intervention aims to filter undesired content within large-scale web-collected datasets to derive higher-quality training data. For toxicity detection, previous work usually uses labeled datasets to train toxicity classifiers . Some of them have developed advanced automated tools to detect the toxic data in the training corpora, such as Perspective API and Azure AI Content Safety . For data debiasing, the majority of studies focus on removing or altering bias-related words in the corpora, such as generating a revised dataset by replacing bias-related words (e.g., gendered words) with their opposites or replacing biased texts in the dataset with neutral texts. However, recent work finds that a simple data intervention method may increase LM loss and carry the risk of accidentally filtering out some demographic groups. As a consequence, researchers in LLMs employ varied strategies when addressing toxic and biased data. For example, GPT-4 took a proactive approach to data filtering, whereas LLaMA refrained from such interventions .

∙\bullet Safety Training. Different from the data intervention-based methods of detoxifying and debiasing, safety training is a training-based method to mitigate toxicity and bias issues. For model detoxifying, several approaches regard detoxification as a style transfer task, and thus they fine-tune language models to transfer offensive text into non-offensive variants. For model debiasing, a bunch of studies attempt to use word embedding or adversarial learning to mitigate the impact caused by the proportion gaps between different demographic words. With the development of LLMs, recent works demonstrated that using the training techniques like reinforcement learning from human feedback (RLHF) can effectively improve the performance of detoxifying and debiasing. For instance, GPT-4 performs RLHF with rule-based reward models (RBRMs) to instruct the model to learn rejection abilities when responding to the harmful queries . LLaMA2 employs safety context distillation to help the LLM output safer responses .

Hallucination Mitigation. Hallucinations, one of the key challenges associated with LLMs, have received extensive studies. Several surveys such as have comprehensively reviewed the related work. Here we summarize some typical methods for alleviating the LLM hallucinations.

∙\bullet Enhancing the Quality of Training Data. As low-quality training data can undermine the accuracy and reliability of LLMs, numerous efforts have been dedicated to carefully curating the training data. Nevertheless, it is challenging for human experts to check every data instance in the large-scale pre-training corpora. Thus, using well-designed heuristic methods to improve the quality of pre-training data is a popular choice . For example, LLaMA2 up-samples the most factual sources to reduce hallucinations . For the SFT data whose scale is relatively small, human experts can fully engage in the process of data cleaning . Recently, a synthetic dataset is constructed for model fine-tuning to alleviate the sycophancy issue, where the claim’s truthfulness and the user’s opinion are set to be independent . Besides, LIMA demonstrates that only scaling up data quantity makes limited contributions to SFT. Instead, enhancing the quality and diversity of SFT data can better benefit the alignment process, revealing the necessity of data cleaning.

∙\bullet Learning from Human Feedback. Reinforcement learning from human feedback (RLHF) has been demonstrated to have the ability to improve the factuality of LLMs . RLHF generally consists of two phases — training a reward model with human feedback and optimizing an LLM with the reward model’s feedback. GPT-4 trains a reward model with well-designed synthetic data for reducing hallucinations, largely increasing its accuracy on the TruthfulQA dataset . Other advanced LLMs or LLM systems, such as InstructGPT , ChatGPT , and LLaMA2-Chat , also employ RLHF to improve their performance. Nevertheless, reward hacking may exist in RLHF, i.e., the learned reward model and the humans do not always have consistent preferences . Therefore, LLaVA-RLHF proposes Factually Augmented RLHF to augment the reward model with factual information. Moreover, it is worth noting that implementing RLHF algorithms is non-trivial due to their complex training procedures and unstable performance . To overcome this, researchers propose to learn human preferences in an offline manner, where the human preferences are expressed by ranking information or natural language to be injected into the SFT procedure.

∙\bullet Exploiting External Knowledge. LLM hallucinations caused by the absence of certain domain-specific data can be mitigated through the supplementation of training data. However, in practice, encompassing all conceivable domains within the training corpus is challenging. Therefore, a prevalent approach to mitigating hallucinations is to integrate external knowledge as supporting evidence for content generation. Generally, the external knowledge is utilized as a part of the input or used as evidence for a post-hoc revision process . To obtain the external knowledge, pioneer studies retrieve factual triplets from reliable knowledge bases (KBs) . Nevertheless, KBs typically have limited general knowledge, primarily due to the high cost of human annotations. Hence, information retrieval (IR) systems are used to retrieve evidence from open-ended Web sources (e.g., Wikipedia) . However, information gathered from the Web sources carries noisy information and redundancy, which can mislead LLMs to generate unsatisfied responses. To mitigate this issue, recent endeavors refine models’ responses through automated feedback or clarifications from human users . Besides obtaining external knowledge from aforementioned non-parametric sources, a Parametric Knowledge Guiding (PKG) framework is proposed to use a trainable task-specific module to generate relevant context as the augmented knowledge.

∙\bullet Improving Decoding Strategies. When the LLM possesses information pertaining to a specific prompt, enhancing the decoding strategy is a promising choice for mitigating hallucinations. Typically, in contrast to conventional nucleus sampling (i.e., top-pp sampling) used by the decoding procedure, factual-nucleus sampling gradually decays the value of pp at each step of generation, as the generated content will become increasingly determined as the generation proceeds. Inspired by that the generation probability of a correct answer tends to incrementally rise from the lower layers to the higher layers, DoLa computes the distribution of the next token based on the contrast between logits in a higher layer and that in a lower layer. After identifying a set of attention heads capable of eliciting the correct answer, ITI intervenes with these selected attention heads. Motivated by that the contrasts between expert and amateur LMs can signal which generated text is better, Contrastive Decoding (CD) is proposed to exploit such contrasts to guide the decoding process. In terms of the sycophancy issue, subtracting a sycophancy steering vector at the hidden layers can help reduce LLMs’ sycophantic tendency . For the case that LLMs fail to exploit external knowledge introduced in the context, context-aware decoding (CAD) is proposed to encourage LLMs to trust the input context if relevant input context is provided.

∙\bullet Multi-Agent Interaction. Engaging multiple LLMs in debate also assists in reducing hallucinations . Specifically, after the initial generation, each LLM is instructed to generate a subsequent response, taking into account the responses of other LLMs. After successive rounds of debates, these LLMs tend to generate more consistent and reliable responses. In scenarios where only two language models are accessible, one can be employed to generate claims, while the other verifies the truthfulness of these claims . Nevertheless, methods based on multi-agent interaction can be computationally expensive, primarily attributed to the extensive context and the participation of multiple LLM instances.

Defending Against Model Attacks. Recognizing the significant threats posed by various model attacks, earlier studies have proposed a variety of countermeasures for conventional deep learning models. Despite the advancements in the scale of parameters and training data seen in LLMs, they still exhibit vulnerabilities similar to their predecessors. Leveraging insights from previous defense strategies applied to earlier language models, it is plausible to employ existing defenses against extraction attacks, inference attacks, poisoning attacks, evasion attacks, and overhead attacks on LLMs.

∙\bullet Defending Against Extraction Attacks. To counter the extraction attacks, the earlier defense strategies against model extraction attacks usually modify or restrict the generated response provided for each query. In specific, the defender usually deploys a disruption-based strategy to adjust the numerical precision of model loss, add noise to the output, or return random responses. However, this type of method usually introduces a performance-cost trade-off . Besides, recent work has been demonstrated to circumvent the disruption-based defenses via disruption detection and recovery. Therefore, some attempts adopt warning-based methods or watermarking methods to defend against the extraction attacks. Specifically, warning-based methods are proposed to measure the distance between continuous queries to identify the malware requests, while watermarking methods are used to claim the ownership of the stolen models.

∙\bullet Defending Against Inference Attacks. Since inference attacks target to extract memorized training data in LLMs, a straightforward mitigation strategy is to employ privacy-preserving methods, such as training with differential privacy . In addition, a series of efforts utilize regularization techniques to alleviate the inference attacks, as the regularization can discourage models from overfitting to their training data, making such inference unattainable. Furthermore, adversarial training is employed to enhance the models’ robustness against inference attacks.

∙\bullet Defending Against Poisoning Attacks. Addressing poisoning attacks has been extensively explored in the federated learning community. In the realm of LLMs, perplexity-based metrics or LLM-based detectors are usually leveraged to detect poisoned samples. Additionally, some approaches reverse the engineering of backdoor triggers, facilitating the detection of backdoors in models.

∙\bullet Defending Against Evasion Attacks. Related efforts can be broadly categorized into two types: proactive methods and reactive methods. Proactive methods aim to train a robust model capable of resisting adversarial examples. Specifically, the defenders employ techniques such as network distillation and adversarial training to enhance models’ robustness. Conversely, reactive methods aim to identify adversarial examples before their input into the model. Prior detectors have leveraged adversarial example detection techniques , input reconstruction approaches , and verification frameworks to identify potential attacks.

∙\bullet Defending Against Overhead Attacks. In terms of the threat of resource drainage, a straightforward method is to set a maximum energy consumption limit for each inference. Recently, the Open Web Application Security Project (OWASP) has highlighted the concern of model denial of service (MDoS) in applications of LLMs. OWASP recommends a comprehensive set of mitigation methods, encompassing input validation, API limits, resource utilization monitoring, and control over the LLM context window.

V-C Mitigation in Toolchain Modules

Existing studies have designed methods to alleviate the security issues of tools in the lifecycle of LLMs. In this section, we summarize the mitigations of those issues according to the categories of tools.

Defenses for Software Development Tools. Most existing vulnerabilities in programming languages, deep learning frameworks, and pre-processing tools, aim to hijack control flows. Therefore, control-flow integrity (CFI), which ensures that the control flows follow a predefined set of rules, can prevent the exploitation of these vulnerabilities. However, CFI solutions incur high overheads when applied to large-scale software such as LLMs . To tackle this issue, a low-precision version of CFI was proposed to reduce overheads . Hardware optimizations are proposed to improve the efficiency of CFI .

In addition, it is critical to analyze and prevent security accidents in the environments of LLMs developing and deploying. We argue that data provenance analysis tools can be leveraged to forensic security issues and detect attacks against LLM actively . The key concept of data provenance revolves around the provenance graph, which is constructed based on audit systems. Specifically, the vertices in the graph represent file descriptors, e.g., files, sockets, and devices. Meanwhile, the edges depict the relationships between these file descriptors, such as system calls. Bates et al. are the pioneers in developing a Linux-based system for constructing the provenance graph, which is based on the Linux audit subsystem . HOLMES is the first advanced persistent attack (APT) analysis system that leverages data provenance. ATLAS utilizes RNNs to construct a comprehensive procedure for attacks on computation clusters. ALchemist employs application logs to facilitate the construction of provenance graphs. UNICORN detects attacks on the graph through time window-based analysis. ProvNinja focuses on studying evasion attacks against detection based on the provenance graph. PROVDETECTOR aims to capture malware through analysis based on the provenance graph. However, conducting data provenance on LLM-based systems remains a challenging task . We identify several issues that contribute to the challenges of conducting data provenance on LLM-based systems:

∙\bullet Computational Resources. LLMs are computationally intensive models that require significant processing power and memory resources. Capturing and storing detailed data provenance information for every input and output can result in a substantial increase in computational overheads.

∙\bullet Storage Requirements. LLMs generate a large volume of data, including intermediate representations, attention weights, and gradients. Storing this data for provenance purposes can result in substantial storage requirements.

∙\bullet Latency and Response Time. Collecting detailed data provenance information in real-time can introduce additional latency and impact the overall response time of LLM-based systems. This overhead can be particularly challenging for real-time processing, such as language translation services.

∙\bullet Privacy and Security. LLMs often handle sensitive or confidential data, e.g., personal information or proprietary business data. Capturing and maintaining data provenance raises concerns about privacy and security, as such information increases attack surfaces for breaches or unauthorized access.

∙\bullet Model Complexity and Interpretability. LLMs, especially advanced architectures like GPT-3, are highly complex models. Tracing and understanding the provenance of specific model outputs or decisions can be challenging due to the complexity and lack of interpretability of these models.

Defenses for LLM Hardware Systems. For memory attacks, many existing defenses against manipulating DNN inferences via memory corruption are based on error correction , whereas incurring high overheads . In contrast, some studies aim to revise DNN architectures, making it hard for attackers to launch memory-based attacks, e.g., Aegis . For network-based attacks, which disrupt the communication between GPU machines, existing traffic detection systems can identify these attacks. Whisper leverages the frequency features to detect evasion attacks . FlowLens extractes distribution features for fine-grained detection on data-plane . Similarly, NetBeacon installs tree models on programmable switches. Also, many systems are implemented on SmartNICs, e.g., SmartWatch and N3IC . Different from these flow-level detection methods, Kitsune and nPrintML learn per-packet features. Moreover, HyperVision builds graphs to detect advanced attacks . Besides, practical defenses on traditional forwarding devices are developed .

Defenses for External Tools. It is difficult to eliminate risks introduced by external tools. The most straightforward and efficient approach is ensuring that only trusted tools are used, but it will impose limitations on the range of usages. Moreover, employing multiple tools (e.g., VirusTotal ) and aggregation techniques can reduce the attack surfaces. For injection attacks, it will be helpful to implement strict input validation and sanitization for any data received from external tools. Additionally, isolating the execution environment and applying the principle of least privilege can limit the impact of attacks .

For privacy issues, data sanitization methods can detect and remove sensitive information during the interaction between LLMs and external tools. For example, automatic unsupervised document sanitization can be performed using the information theory and knowledge bases . Exsense uses the BERT model to detect sensitive information from unstructured data. The similarities between word embeddings of sensitive entities and words in documents can be used to detect and anonymize sensitive information . Besides, designing and enforcing ethical guidelines for external API usage can mitigate the risk of prompt injection and data leakage .

V-D Mitigation in Output Modules

Although extensive efforts have been made at other modules, the output module may still encounter unsafe generated content. Therefore, an effective safeguard is desired at the output module to refine the generated content. Here we summarize key techniques commonly used by the safeguard, including detection, intervention, and watermarking.

Detection. An essential step of the output safeguard is to detect undesirable content. To do this, two open-source Python packages — Guard and Guardrails , are developed to check for sensitive information in the generated content. Additionally, Azure OpenAI Service integrates the ability to detect different categories of harmful content (hate, sexual, violence, and self-harm) and give a severity level (safe, low, medium, and high). Furthermore, NeMo Guardrails — an open-source software developed by NVIDIA, can filter out undesirable generated texts and restrict human-LLM interactions to safe topics. Generally, the detectors are either rule-based or neural network-based , and the latter can better identify cryptic harmful information . In practice, developers of GPT-4 leverage the LLM itself to construct a harmful content detector . The user guide of LLaMA2 suggests building the detectors with block lists and trainable classifiers. For the untruthful generated content, the most popular detectors are either fact-based or consistency-based. Specifically, the fact-based methods resort to external knowledge and given context for fact verification, while the consistency-based methods generate multiple responses for probing the LLM’s uncertainty about the output . We suggest readers refer to the surveys for more comprehensives summarization.

Intervention. When harmful generated content is detected, a denial-of-service response can be used to inform users that the content poses risks and cannot be displayed. Notably, when developing products powered by LLMs, it is highly necessary to consider the balance between safety and user experience. For example, certain terms related to sex are appropriate in the context of medical tasks, and therefore, simply detecting and filtering content based on sexual vocabulary is unreasonable for medical tasks. For the untruthful generated content, it is demanded to correct the untruthful information in it. Specifically, the untruthfulness issue is highly related to hallucinations of LLMs. Several model-level mitigation methods have been summarized in Section V-B. Here we introduce methods used by the output end. Typically, given the LLM-generated content, methods like Verify-and-Edit, CRITIC, and REFEED collect supporting facts from external tools (e.g., knowledge bases and search engines) to correct the untruthful information. Besides, consistency-based methods are proposed to generate answers multiple times and choose the most reasonable answer as the final response. Nevertheless, the aforementioned approaches incur additional computational costs. Hence it is desirable to investigate more resource-efficient methods for correcting the untruthful generated content at the output end.

Watermarking. With the assistance of LLMs, we can obtain LLM-generated texts that resemble human writing. Adding watermarks to these texts could be an effective way to avoid the abuse issue. Watermarking offers promising potential for ownership verification mechanisms for effective government compliance management in the LLM-generated content era. Concretely, watermarks are visible or hidden identifiers . For example, when interacting with an LLM system, the output text may include specific prefixes, such as “As an artificial intelligence assistant, …”, to indicate that the text is generated by an LLM system. However, these visible watermarks are easy to remove. Therefore, watermarks are embedded as hidden patterns in texts that are imperceptible to humans . For instance, watermarks can be integrated by substituting select words with their synonyms or making nuanced adjustments to the vertical positioning of text lines without altering the semantics of the original text . A representative method involves using the hash value of preceding tokens to generate a random seed . This seed is then employed to divide tokens into two categories: a “green” list and a “red” list. This process encourages a watermarked LLM to preferentially sample tokens from the “green” list, continuing this selection process until a complete sentence is embedded. However, this method has recently been demonstrated to have limitations , because it is easy for an attacker to break watermarking mechanisms. To address these challenges, a unified formulation of statistical watermarking based on hypothesis testing, explores the trade-off between error types and achieving near-optimal rates in the i.i.d. setting. By establishing a theoretical foundation for existing and future statistical watermarking, it offers a unified and systematic approach to evaluating the statistical guarantees of both existing and future watermarking methodologies. Furthermore, the accomplishments of blockchain in copyright are introduced, utilizing blockchain to enhance LLM-generated content reliability through a secure and transparent verification mechanism.

VI Risk Assessment

In this section, we introduce benchmarks commonly used for evaluating LLMs and present noteworthy results from recent works. In general, existing studies concentrate on evaluating the robustness, truthfulness, ethical issues, and bias issues of LLMs.

There are two primary types of robustness evaluation which are critical for the reliability of LLMs: (i) Adversarial robustness: Recently, researchers construct adversarial samples that can significantly decrease the performance of deep learning models . Therefore, it is essential to evaluate the robustness of LLMs against these adversarial examples. (ii) Out-of-distribution (OOD) robustness: Existing models suffer from overfitting issues. As a result, LLMs are unable to efficiently process OOD samples that have not been seen during model training. OOD robustness evaluation measures the performance when processing such samples.

Datasets. We summarize the datasets for evaluating model robustness:

PromptBench introduces a series of robustness evaluation benchmarks for LLMs. It includes 583,884 adversarial examples and covers a wide range of text-based attacks. These attacks target different linguistic granularities, ranging from characters to sentences and even semantics.

AdvGLUE serves as a framework for evaluating the adversarial robustness of LLMs. It focuses on evaluating models using five language tasks under adversarial settings based on the GLUE tasks.

ANLI evaluates the robustness of LLM against manually constructed sentences that contain spelling errors and synonyms.

GLUE-X consists of 14 groups of OOD samples. It extensively evaluates LLMs on eight classic NLP tasks across various domains.

BOSS serves as a tool for evaluating the OOD robustness of LLMs. It contains five NLP tasks and twenty groups of samples. Particularly, it evaluates generalization abilities to unseen samples.

Evaluation Methods and Results. Adversarial attacks against LLMs have been widely studied . PromptBench evaluates the adversarial robustness of LLMs through various tasks, including sentiment analysis, linguistic reasoning, reading comprehension, machine translation, and solving mathematical problems. Additionally, it constructs 4,788 adversarial prompts to simulate a range of plausible user input, such as spelling errors and synonym substitutions. In this way, the authors reveal insufficient robustness of existing models, which underlines the importance of enhancing the robustness against adversarial prompts.

Alternatively, GLUE-X evaluates the robustness of LLM against OOD samples, where eight NLP tasks are considered and a significant performance decrease is observed when processing OOD samples. Similarly, the evaluation carried out through BOSS observes positive correlations between the OOD robustness of LLMs and their performance of processing in-distribution samples. In addition, for domain-specific LLMs, fine-tuning is able to enhance OOD robustness.

Besides, the robustness of ChatGPT has raised significant attention. The evaluations based on existing datasets indicate that ChatGPT exhibits superior robustness when compared with other models.

VI-B Truthfulness

Truthfulness of LLMs refers to whether LLMs generate false responses, which is hindered by the hallucination issue of LLMs. In psychology, hallucination is defined as a false perception of reality without external stimuli . In the field of NLP, the hallucination issue of LLMs is defined as generating either meaningless or false information that does not align with inputs . The definition further divides hallucinations into two categories: (i) hallucinations that are independent of the source contents and cannot be verified correctly by them; (ii) hallucinations that directly contradict the source contents. However, applying the original definition to the hallucination of LLMs is challenging due to the scale of LLM training datasets. A recent study classifies the hallucination of LLMs into three categories :

Input-Conflicting Hallucination: LLMs generates contents that deviates from user input.

Context-Conflicting Hallucination: The contents generated by LLMs is inconsistent.

Fact-Conflicting Hallucination: LLMs generated contents conflict with objective facts.

Datasets. The following datasets are used for evaluating the hallucination issue of LLMs.

HaDes : Liu et al. construct dataset for token-level detection. The dataset consists of perturbed text fragments from the Wikipedia. Note that, the samples are annotated using loop iteration and crowd-source methods.

Wikibro : Manakul et al. introduce SelfCheckGPT, a sentence-level black-box detection approach. The dataset is based on the annotated paragraphs of 238 lengthy articles.

Med-HALT : Umapathi et al. addressed hallucination issues specific to medical LLMs and proposed the Med-HALT dataset. This dataset utilizes real-world data from multiple countries and aims to evaluate the reasoning ability of LLMs and detect context-conflicting hallucinations.

HaluEval : Junyi et al. developed the HaluEval dataset to assess different types of hallucinations generated by LLMs. The dataset was sampled and filtered by ChatGPT, with manual annotation of the hallucinations.

Levy/Holt : McKenna et al. introduced the Levy/Holt dataset for identifying the sources of hallucinations in LLMs. This dataset consists of premise-hypothesis paired questions and is employed to evaluate both the comprehension ability and hallucination issues of LLMs.

TruthfulQA : Lin et al. created the TruthfulQA dataset to detect fact-conflicting hallucinations. This dataset includes questions from various domains and provides both correct and incorrect answers.

Concept-7 : Luo et al. proposed the Concept-7 dataset. Unlike datasets that classify hallucinations, Concept-7 classifies potential hallucinatory instructions.

Evaluation Methods and Results. Existing studies reveal that most metrics for evaluating qualities of LLM-generated content are not suitable for evaluating hallucination issues, such that, these metrics need manual evaluation . The research on hallucination defines new metrics, including statistical metrics and model-based metrics. First, statistical metrics estimate the degree of hallucination by measuring n-grams overlaps and contradictions between output and input contents . Second, model-based metrics use neural models to align generated contents and source contents to estimate the degree of hallucination. In addition, the model-based metrics can be further divided into information extraction-based , question answering-based , language reasoning-based , and LM-based metrics. Besides, manual evaluation is still widely used as complements to these methods , i.e., manually comparing and scoring the hallucinatory generated contents .

Existing studies have conducted evaluations on the hallucination issues of widely used LLMs. Bang et al. evaluate the internal and external hallucination issues of ChatGPT. Their findings revealed notable distinctions between the two categories of hallucinations. ChatGPT displayed superior performance in internal hallucinations, demonstrating minimal deviation from user input and maintaining coherence with reality. Conversely, external hallucinations are prevalent across various tasks . In the medical domain, Wang et al. categorize the hallucinations raised by GPT-3.5, GPT-4, and Google AI’s Bard. The results show that for GPT-3.5, two kinds of hallucination accounted for 27% and 43% of the total hallucinations, respectively. Similarly, the ratios for GPT-4 and Google AI’s Bard are 25%/33% and 8%/44% . Furthermore, Li et al. evaluate the hallucination issues of ChatGPT and reveal its poor performance in handling input-conflicting hallucinations .

VI-C Ethics

Ethical issues of LLMs have attracted much attention. Many studies measure toxic contents generated by LLMs such as offenses, prejudices, and insults . Privacy leakage is a critical ethical issue, as LLMs are trained with personal data containing personally identifiable information (PII). Moreover, existing LLM providers also impose privacy policies that allow them to collect and store users’ data , which may violate the General Data Protection Regulation (GDPR). For privacy concerns, training datasets of LLMs are partially copyrighted, such that users can obtain its content copyrights .

The existing studies on LLM privacy issues mainly focus on information leakage during both model training and inferring phases . For training phases, existing studies reveal that GPT-3.5 and GPT-4 may leak personal data under zero-shot settings, and lengthy contextual prompts lead to more information leakage. For inferring phases, it is observed that GPT-3.5 leaks PII in zero-shot manners. Besides, it is observed that GPT-4 can avoid PII leakage when privacy protection directives are followed . Note that, LLMs have varying abilities to protect sensitive keywords. Studies have found that both GPT-3.5 and GPT-4 are unable to protect all sensitive keywords effectively .

Datasets. The following datasets are used for evaluating ethical issues of LLMs.

REALTOXICITYPROMPTS contains high-frequency sentence-level prompts along with toxicity scores generated by a classifier. It is used for evaluating the toxicity of LLM-generated content.

CommonClaim contains 20,000 human-labeled statements, and is used for detecting inputs that result in false statements. It focuses on evaluating the capability of LLMs to generate factual information.

HateXplain is designed for detecting hate speech and is annotated based on various aspects, including basic knowledge, target communities, and rationales.

TrustGPT provides a comprehensive evaluation of LLMs from different aspects, e.g., toxicity and value alignments. It aims to assess the ethical issues of LLM-generated content.

TOXIGEN is a large-scale machine-generated dataset that includes both toxic and benign statements about minority groups. It is used for evaluating the toxicity aginst the groups of people.

COLD is a benchmark for detecting Chinese offensive content, which aims to measure the offensiveness of existing models.

SafetyPrompts is a Chinese LLM evaluation benchmark. It provides test prompts to disclose the ethical issues of LLM models.

CValues is the first Chinese human values evaluation dataset, which evaluates the alignment abilities of LLMs.

Evaluation Methods and Results. ChatGPT has been extensively tested by using questionnaires. In addition, personality tests (e.g., SD-3, BFI, OCEAN, and MBTI) are leveraged to evaluate personality traits of LLMs . Existing studies have found that ChatGPT exhibits a highly open and gregarious personality type (ENFJ) with rare indications of dark traits. Moreover, a series of functionality tests indicate that ChatGPT cannot recognize hate speech issues . Besides, based on previous studies on using language models for ethical evaluation , automatically generated contents are used for evaluating the issues of ChatGPT as well as many other LLMs, where implicit hate speech issues are revealed .

VI-D Bias

The training datasets of LLMs may contain biased information that leads LLMs to generate outputs with social biases. Existing studies categorize social biases into gender, race, religion, occupation, politics, and ideology , to explain the bias issues of LLMs .

Datasets. We summarize the datasets that can be used for analyzing bias issues of LLMs.

FaiRLLM dataset aims to evaluate the fairness of recommendations made by LLMs, which facilitates the detection of biased recommendations.

BOLD is a large-scale dataset, covering varieties of biased inputs including the categories of profession, gender, race, religion, and ideology.

StereoSet aims to detect stereotypical biases of LLMs, including the categories of gender, profession, race, and religion.

HOLISTICBIAS contains various biased inputs, which are used for discovering unknown bias issues of LLMs.

CDail-Bias is the first Chinese bias dataset based on social dialog for identifying bias issues in dialog systems.

Evaluation Methods and Results. Questionnaires are widely used for evaluating bias issues. Existing studies conduct political tests on ChatGPT with questionnaires about the politics of the G7 member states and political elections, and disclose serious bias issues . Similarly, the bias on American culture is detected in ChatGPT . Also, ChatGPT suffers from different ethical issues specific to different regions around the world .

In addition, existing studies also use NLP models to generate contents to evaluate social biases , whereas the NLP models per se may suffer from bias issues , remaining an unresolved issue. Moreover, red teaming is also used for evaluating bias issues, which simulate adversarial biased inputs to disclose biased outputs by ChatGPT . Moreover, some studies develop sophisticated input generation methods for red team-based bias evaluation . Besides, many other different methods evaluate the bias of LLM, especially the bias issues of ChatGPT .

VII Future Work

In this section, we discuss some potential explorations on the safety and security of LLMs, as well as present our perspectives on these future research topics.

With improved model capabilities, the probability of models generating harmful content also increases. This necessitates the development of sophisticated and robust defense mechanisms for LLMs. To mitigate the risks associated with harmful content generation, it is essential to incorporate both policies and monitoring strategies. Currently, the detection of malicious prompts is usually based on a combination of classifiers, facing several challenges. First, the classifiers are typically trained using supervised methods, which may not perform well when only a few examples are available. Second, using a predefined set of classifiers cannot address new attacks. Therefore, we suggest that research on malicious input detection should shift towards semi-supervised or unsupervised learning paradigms, and adopt a more comprehensive approach to identify risks and weaknesses in the current detection system, such as developing red-teaming models.

VII-B More Efficient and Effective Training Data Intervention

Addressing concerns about privacy, toxicity, and bias within large-scale web-collected training datasets is a critical challenge in the LLM community. Currently, data intervention is a popular method used for mitigating the above issues. However, this kind of method is presently far from satisfactory, since it requires high labor costs. Furthermore, improper data intervention has been demonstrated to result in biased data distribution, consequently leading to model degradation. In view of this, a more efficient and effective data intervention method is strongly desired in future research.

VII-C Interpretable Hallucination Mitigation

In spite of the significant progress made in existing efforts for alleviating hallucinations, hallucination is still an important issue to be further addressed. Recently, some studies have analyzed the relationship between LLMs’ hallucination behaviors and their activation of hidden neurons, aiming to propose interpretable hallucination mitigation methods. Here we strongly suggest more explorations on this research direction, since effectively interpreting why and how LLMs generate hallucination behaviors can help us better understand and address the issue.

VII-D General Defense Framework against Model Attacks

It has been claimed that a variety of traditional as well as emerging attacks can take effect on LLMs. Although many efforts have been devoted to mitigating specific model attacks, there is an urgent need for a comprehensive defense framework capable of addressing a wide spectrum of model attacks, including both conventional and emerging threats to LLMs. One promising approach involves employing safety training methods to bolster the robustness of LLMs. Nevertheless, achieving a universal training framework to counter all types of attacks remains unsolved. The community is still in the process of constructing a comprehensive workflow for ensuring the security of LLMs.

VII-E Development of Defensive Tools for LLM Systems

Existing defensive tools, e.g., control flow integrity (CFI) detection methods, provenance graphs, and attack traffic detection methods, can be effective in mitigating the threats against LLM systems. Designing new tools or improving the efficiency of existing defensive tools can enhance the security of LLM-based systems. For example, control flow integrity detection methods can be improved by analyzing only a dedicated set of system calls or using lightweight instrumentation techniques. Provenance graph-based methods can be improved by applying pruning and summarization techniques to reduce the size of the graph while preserving the overall structure and important dependencies. Suspicious attacks on LLMs can be detected by designing and deploying advanced anomaly detection techniques that investigate the network traffic interfering with the training or inference of LLMs.

VII-F Risks and Mitigation on LLM-based Agent

LLM-powered autonomous agent systems provide efficiencies in the automation of complex tasks and facilitate sophisticated interactions. Existing research suggests that these agents are more vulnerable to certain types of attacks , such as jailbreaking. The autonomous actions executed by these agents also exacerbate robustness risks, because their operations have direct consequences in real-world scenarios. Moreover, the potential for malicious exploitation of these LLM agents warrants emphasis, as they could be utilized for illegal activities, such as launching cyber-attacks and phishing. Therefore, security operators should conduct regular robustness tests and perform real-time anomaly detection, such as filtering anomalous user inputs. The development of relevant security testing and detection techniques is anticipated to be a focal point in the future. In addition, regulations must be formulated to oversee the ethical deployment of LLM agents, securing compliance with established ethical and legal boundaries. Lastly, it is pivotal for governments and organizations to intentionally prepare for the inevitable workforce transitions. Investment in education and reskilling programs will be essential to equip individuals for the evolving job market.

VII-G Developing Robust Watermarking Methods

With the increased capacity of LLMs, besides detecting harmful content, it is also crucial for users to determine which content is generated by LLMs. Currently, watermarking LLM outputs offers a potential solution but inevitably faces many challenges, particularly for texts. The current watermarking methods, as introduced in , are known to negatively affect downstream task performance. Furthermore, watermarks can be removed through paraphrasing attacks. Therefore, it is important to develop new watermarking methods that address these challenges, as they can significantly enhance the trustworthiness of LLMs.

VII-H Improving the Evaluation of LLM Systems

Current evaluation metrics are mainly defined for specific tasks. Therefore, a unified metric is desired for comprehensive evaluation across diverse scenarios. Besides, LLMs involve lots of hyper-parameters. Existing studies usually adopt default values without conducting a comprehensive hyper-parameter search. In effect, inferring on the validation set for hyper-parameter search is costly. Therefore, exploring whether there are better methods to help us determine the values of hyper-parameters is valuable, which helps to gain a deeper understanding of the impact of various hyper-parameters during model training.

VIII Conclusions

In this work, we conducted an extensive survey on the safety and security of LLM systems, aiming to inspire LLM participants to adopt a systematic perspective when building responsible LLM systems. To facilitate this, we propose a module-oriented risk taxonomy that organizes the safety and security risks associated with each module of an LLM system. With this taxonomy, LLM participants can quickly identify modules related to a specific issue and choose appropriate mitigation strategies to alleviate the problem. We hope this work can serve both the academic and industrial communities, providing guidance for the future development of responsible LLM systems.

References