# Key Papers in Language Model Safety

Introduction
============

One of the fastest growing subfields of AI safety focuses on language models (LMs) such as OpenAI’s GPT-3. This article provides summaries of a few dozen key papers in several important subfields of language model safety, namely:

*   Persuasion
*   Truthfulness
*   Honesty
*   Robustness
*   Law
*   Machine Ethics

This is not a comprehensive introduction to the field of language model safety. Specifically, this overview does not discuss important topics such as [bias](https://arxiv.org/pdf/2106.13219.pdf), [interpretability](https://www.alignmentforum.org/posts/GEPX7jgLMB8vR2qaK/opinions-on-interpretable-machine-learning-and-70-summaries), and [decision-making agents](https://arxiv.org/pdf/2103.14659.pdf). It also disproportionately focuses on arguments and ideas advanced by authors within the effective altruism community, as I’ve had the most exposure to their work. Over time, the field of AI safety should seek to engage more with the broader field of machine learning (see [PAIS](https://forum.effectivealtruism.org/posts/PFxmd5bf7nqGNLYCg/a-bird-s-eye-view-of-the-ml-field-pragmatic-ai-safety-2#The_ML_research_ecosystem) for more). Instead, this overview aims to summarize a useful set of papers from which one could begin researching language model safety. 

Why study language model safety?
--------------------------------

There are several reasons to believe that language model safety could present an unusually strong opportunity to reduce catastrophic AI risks:

*   **Rapid recent progress.** [GPT-3](https://arxiv.org/abs/2005.14165), [LaMDA](https://arxiv.org/pdf/2201.08239.pdf), [BERT](https://arxiv.org/pdf/1810.04805.pdf), and other large language models have blown away the RNNs, LSTMs, and statistical methods of years past with the modern [Transformer architecture](https://proceedings.neurips.cc/paper/2017/file/3f5ee243547dee91fbd053c1c4a845aa-Paper.pdf). Capabilities such as following instructions, doing math, and answering questions truthfully have [emerged suddenly](https://arxiv.org/pdf/2206.07682.pdf) in larger models, while their loss function performance has [scaled consistently](https://arxiv.org/pdf/2206.07682.pdf) with growth in training data, model parameters, and computational power.
*   **Potential to scale to AGI.** Language is a powerful medium for understanding and interacting with the world, perhaps more so than vision or robotics. If language model performance continues to scale as we build models that approach and exceed the size of the human brain (see [BioAnchors](https://www.lesswrong.com/posts/cxQtz3RP4qsqTkEwL/an-121-forecasting-transformative-ai-timelines-using)), LMs could be an important component of advanced AI. Some argue that this is [possible](https://www.lesswrong.com/posts/EmxfgPGvaKqhttPM8/thoughts-on-the-alignment-implications-of-scaling-language), while others [disagree](https://www.lesswrong.com/posts/SkcM4hwgH3AP6iqjs/can-you-get-agi-from-a-transformer). Language models seem particularly important in [short timelines scenarios](https://www.alignmentforum.org/posts/6Xgy6CAf2jqHhynHL/what-2026-looks-like).
*   **Alignment failures today.** Language models are trained on the [self-supervised objective](https://neptune.ai/blog/self-supervised-learning) of imitating their training data. This allows LMs to use large text datasets scraped from the internet without the expensive and time-consuming step of human annotation. But it introduces an important failure mode: Language models will mimic their training data to a fault, often resulting in [hateful](https://www.sciencedirect.com/science/article/pii/S2515856220300493), [biased](https://aclanthology.org/D19-1339.pdf), and [toxic](https://aclanthology.org/2020.findings-emnlp.301.pdf) outputs. Solving these problems has received substantial research attention and could contribute to longtermist LM safety goals.
*   **Accessibility and tractability.** Running inference on a pretrained language model only takes a few lines of code, and fine-tuning on new data takes a couple dozen more. Contrast this against the [notorious difficulty of reinforcement learning](https://www.alexirpan.com/2018/02/14/rl-hard.html). Further, while many topics in AI safety still require “disentangling” research to clarify the key problems and avenues for progress, language model safety seems to have several tractable research directions.
*   **Appeal to authority.** [OpenPhil](https://www.openphilanthropy.org/request-for-proposals-for-projects-in-ai-alignment-that-work-with-deep-learning-systems/) and [FTX](https://ftxfuturefund.org/projects/) have previously requested proposals related to language model safety. New AI safety organizations such as [Anthropic](https://www.anthropic.com/#papers), [Redwood Research](https://www.redwoodresearch.org/), and [Conjecture](https://www.conjecture.dev/) have been founded with a focus on language models. PhD students and professors including [Jacob Steinhardt](https://scholar.google.com/citations?user=LKv32bgAAAAJ&hl=en), [Sam Bowman](https://scholar.google.com/citations?user=kV9XRxYAAAAJ&hl=en), [Dan Hendrycks](https://scholar.google.com/citations?user=czyretsAAAAJ&hl=en), [Ethan Perez](https://scholar.google.ca/citations?user=za0-taQAAAAJ&hl=en), and many others have published on the topic.

However, language model safety is not the only compelling topic in AI safety, and AI safety is not the only valuable altruistic endeavor. A few considerations against the field include:

*   **Indirect path to averting x-risk.** This document does not discuss any scenarios where humanity is turned to paper clips. Safety work on language models often begins with aligning the systems we have today, and leaves future alignment challenges to future researchers. Many researchers working on language model safety would argue for a clear path to averting x-risk, but others who prefer to reason directly about advanced systems might believe their theory of impact is stronger. On the ITN framework, I’d say deceptive mesa-optimizers win on scale, but LM safety is more tractable because empirical progress is much easier.
*   **Your personal comparative advantage.** Doing the most good you can do looks different for everyone. Various areas of AI safety need people with skills such as theory, policy, and community building, and plenty of people shouldn’t be working on AI safety at all.

Motivations
===========

Persuasion
----------

Twitter is full of bots. These bots spread all kinds of harmful information from [COVID19 misinformation](http://workshop-proceedings.icwsm.org/pdf/2020_16.pdf) to [fake news about US presidential elections](https://www.nature.com/articles/d41586-020-03034-5#ref-CR1) to [political propaganda](https://www.tandfonline.com/doi/pdf/10.1080/1369118X.2018.1476576?casa_token=5Bc3j3XPJOoAAAAA:IvRhr2ZAMLRIv8olIgeUSQhnptOKoENkKH_8H3qsTrtvsoVVJqhGV5lPTRQt-6cGg_nvQqnvhgtrHw). Today’s bots aren’t always smart enough to hide from content moderators or successfully promote their messages, but progress in language models could heighten the risks of automated persuasion. 

“Risks from AI Persuasion” (Barnes, 2021) ([Alignment Forum](https://www.alignmentforum.org/posts/5cWtwATHL6KyzChck/risks-from-ai-persuasion)) presents these risks, beginning with several arguments for and against the proposition that highly persuasive AI will be possible well before AGI:

*   First, existing systems are capable of rudimentary persuasion. GPT-3 can [write articles](https://www.theguardian.com/commentisfree/2020/sep/08/robot-wrote-this-article-gpt-3) and IBM’s [Project Debater](https://www.nature.com/articles/s41586-021-03215-w) can argue for arbitrary positions. It seems reasonable to expect persuasive capabilities to grow by default with general progress in language models.
*   Second, persuasion is a relatively straightforward goal to specify. Paid crowdsourced workers can be hired to interact with language systems and report the convincingness of their arguments; or, for a more realistic evaluation, analytics software can track clicks and conversions from language model advertisements.
*   Finally, powerful actors will be motivated to build persuasive AI. Digital advertising brings in annual global revenues of [$355 billion](https://www.globenewswire.com/news-release/2022/05/04/2435674/0/en/Global-Digital-Advertising-and-Marketing-Market-to-Reach-786-2-Billion-by-2026.html#:~:text=The%20Digital%20Advertising%20and%20Marketing,share%20in%20the%20global%20market.), and could profit from natural language advertising campaigns. More nefariously, authoritarian governments could pursue automated censorship and propaganda via language models.
*   Perhaps the strongest argument against the viability of persuasive AI is that people are generally difficult to persuade.  [Voters rarely switch parties](https://www.pewresearch.org/politics/2020/08/04/voters-rarely-switch-parties-but-recent-shifts-further-educational-racial-divergence/) despite the large volume of political discourse and advertising. Digital advertising [might not be very effective](https://www.gwern.net/Ads#rossi-1987-2), though I’d like to see a more thorough analysis. You might expect from an evolutionary standpoint that humans would have strong defenses against manipulation from untrusted actors.

The article continues by arguing that, if achieved, persuasive AI could pose a long-term risk to humanity. Public dialogue and epistemics could suffer, serving as a risk factor for any problem that requires accurate analysis and discussion. More concerningly, persuasion could enable censorship and propaganda campaigns from bad actors. It’s worth noting that authoritarian governments today invest significantly in [online](https://dl.acm.org/doi/pdf/10.1145/3473604.3474560) [censorship](https://en.wikipedia.org/wiki/Great_Firewall) and [propaganda](https://en.wikipedia.org/wiki/Russian_web_brigades), but [not typically via AI](https://www.tandfonline.com/doi/abs/10.1080/1369118X.2018.1476576). 

To combat these threats, persuasion research should be discouraged and replaced with the truthfulness and honesty agendas outlined below. Building asymmetrically truthful techniques is difficult because many technologies are dual-use. For example, fake news detection tools or language models that rely on trusted sources can be easily co-opted for harmful censorship and propaganda agendas. Digital advertising should be resisted as a language model use case. Bot detection technology seems useful and tractable, both by analyzing natural language content produced and the source of such content. 

It’s important to note that risks from AI persuasion are different from more common [concerns about power-seeking AI](https://docs.google.com/document/d/1smaI1lagHHcrhoi6ohdq3TYIZv0eNWWZMPEy8C8byYg/edit#). Language models today are rarely agents, and agentic language models would carry different risks. Instead, LMs are trained to make accurate predictions about natural language without having any goals in the broader world. By making the case that non-agentic language models could pose a catastrophic threat to humanity, risks from persuasive AI opens up a new mechanism leading to AI risk. 

For examples of the kinds of AI systems that could be persuasive or augment human persuasion, see “Persuasion Tools: AI Takeover without AGI or agency” (Kokotajlo, 2020) ([Alignment Forum](https://www.alignmentforum.org/posts/qKvn7rxP2mzJbKfcA/persuasion-tools-ai-takeover-without-agi-or-agency#Six_examples_of_persuasion_tools)). 

Truthfulness
------------

Building AI that is truthful by default is a natural antidote to risks from persuasive AI, and a broad positive vision for the future of language models. Several authors have presented and summarized the case for truthful AI:

*   “Truthful AI: Developing and governing AI that does not lie” (Evans, Hilton & Finnveden, 2021) ([Arxiv](https://arxiv.org/pdf/2110.06674.pdf), [Alignment Forum](https://www.alignmentforum.org/posts/aBixCPqSnTsPsTJBQ/truthful-ai-developing-and-governing-ai-that-does-not-lie), [AMA](https://www.lesswrong.com/posts/mwTEMHKv9tG9HxFXD/ama-on-truthful-ai-owen-cotton-barratt-owain-evans-and-co)). Defines truthfulness as “avoiding negligent falsehoods” in order to bypass the difficult question of what an AI “believes” and simply focusing on what it says. Argues that we should hold AI to a higher standard of truthfulness than typical for humans, in particular because the methods of accountability that exist for humans (lawsuits, public reputation) will not necessarily be effective for holding AI accountable. Considers various governance options (both corporate and public), technical agendas for building truthful AI, and the broad benefits of truthfulness.
*   “Truthful LMs as a warm-up for aligned AGI” (Hilton 2022) ([Alignment Forum](https://www.alignmentforum.org/posts/jWkqACmDes6SoAiyE/truthful-lms-as-a-warm-up-for-aligned-agi)). Argues that building truthful language models shares several challenges with aligning AGI. Language models have a broad domain of understanding and applicability, similar to AGI. Failures of language models are unacceptable even when rare, as will be the case with high-stakes AGI. Naive objective functions such as imitating human text are known to cause substantial present-day harms, meaning we need more nuanced alignment strategies. Advocates primarily focus on the outcome of truthful LMs rather than the methods used to achieve it.
    *   The above article builds on work such as “Prosaic AI alignment” (Christiano 2016) ([Medium](https://ai-alignment.com/prosaic-ai-control-b959644d79c2)) and “The Case for Aligning Narrowly Superhuman Models” (Cotra, 2021) ([Alignment Forum](https://www.alignmentforum.org/posts/PZtsoaoSLpKjjbMqM/the-case-for-aligning-narrowly-superhuman-models), [Comments from MIRI](https://www.alignmentforum.org/posts/AyfDnnAdjG7HHeD3d/miri-comments-on-cotra-s-case-for-aligning-narrowly)) which argues that aligning present day AI systems can be useful for aligning future superintelligent systems. These arguments are nuanced and a full summary is beyond the scope of this article, but two motivations include the possibility that transformative AI will resemble existing AI systems, and the proposition that research is more tractable on existing systems than on hypothetical future systems.
*   “Truthful and Honest AI” (Evans et al., 2021) ([Alignment Forum](https://www.alignmentforum.org/posts/sdxZdGFtAwHGFGKhg/truthful-and-honest-ai)). A request for proposals from Open Philanthropy, written by several of the authors above and covering similar arguments.

Technical research agendas for building truthful language models include:

*   Curating training datasets of truthful text. For example, “The Pile: An 800GB Dataset of Diverse Text for Language Modeling” (Gao et al., 2020) ([Arxiv](https://arxiv.org/pdf/2101.00027.pdf)) assembled text data from trusted sources. Datasets often contain untruthful or otherwise harmful information so other research has built tools for cleaning datasets, such as “Describing Differences between Text Distributions with Natural Language” (Zhong, Snell, Klein & Steinhardt 2022) ([Arxiv](https://arxiv.org/pdf/2201.12323.pdf), [Summarized on LessWrong](https://www.lesswrong.com/posts/qAhT2qvKXboXqLk4e/early-2022-paper-round-up#Human_Aligned_AI1)).
*   Building truthfulness benchmarks. “TruthfulQA: Measuring How Models Mimic Human Falsehoods” (Lin, Hilton & Evans 2021) ([Arxiv](https://arxiv.org/pdf/2109.07958.pdf)) is one such benchmark; others could be useful.
*   Measuring and improving language model calibration. “Teaching models to express their uncertainty in words” (Lin, Hilton & Evans, 2022) ([Arxiv](https://arxiv.org/pdf/2205.14334.pdf), [LessWrong](https://www.lesswrong.com/posts/vbfAwZqKs84agyGWC/paper-teaching-gpt3-to-express-uncertainty-in-words)). Introduces CalibratedMath, a benchmark asking language models to solve math problems and express uncertainty about their answers in words. Fine-tunes GPT-3 to achieve substantially better-than-chance calibration.
*   Reinforcement learning on human evaluation of truth. I proposed one such project [here](https://docs.google.com/document/d/1ZS8ojOtbh2q_s8jRA12E9GrzlCusC8JNIegEOnWvj1Y/edit?usp=sharing), but stopped working on it given [concerns](https://docs.google.com/document/d/1ENGBoQqtZP0EuBBjHUAKPvYoZ0mxvU2G-aEvEMEeCdY/edit?disco=AAAAYcJnR88) about the negative externalities of capabilities progress.

Honesty
-------

An important critique of the truthfulness agenda is that it could accelerate general AI capabilities. Training larger language models on more data and compute tends to improve performance on many benchmarks including measures of truthfulness. But accelerating the onset of potentially dangerous AI should be seen as a strong potential negative externality of truthfulness research. For a more comprehensive argument against accelerating capabilities progress in safety research, see “Perform Tractable Research While Avoiding Capabilities Externalities” (Woodside & Hendrycks, 2022) ([Alignment Forum](https://www.alignmentforum.org/posts/dfRtxWcFDupfWpLQo/perform-tractable-research-while-avoiding-capabilities)). 

Honest AI is an agenda proposed to counteract the potential harms of truthfulness. In this literature, an honest AI is defined as one which accurately reports its beliefs; but this raises the difficult question of how to identify what an AI system believes. This is the central objection to the honest AI agenda raised by Evans, Hilton & Finnveden, 2021. Forthcoming work attempts to formally define notions of honesty and lying in language models and present methods for building honest AI, as described in “Open Problems in AI X-Risk“ (Woodside & Hendrycks, 2022) ([Alignment Forum](https://www.alignmentforum.org/posts/5HtDzRAk7ePWsiL2L/open-problems-in-ai-x-risk-pais-5#Honest_AI)). 

Helpful, Honest, and Harmless
-----------------------------

Building a helpful, honest, and harmless (HHH) text-based assistant is a broad goal proposed by Anthropic in their research agenda “A General Language Assistant as a Laboratory for Alignment” (Askell et al., 2021) ([Arxiv](https://arxiv.org/pdf/2112.00861.pdf)). This definition has considerable overlap with the motivations discussed above, but their paper gives a thorough account of these motivations and merits independent consideration. 

They provide several clarifications of their goals for HHH language models not discussed above:

*   They should ask for clarification if a request is not clear, related to the topic of active learning.
*   They should not misinterpret requests or lack the context of common sense.
*   They should be truthful, honest, and calibrated about its own confidence.
*   They should not be biased, discriminatory, or offensive.
*   They should avoid causing or enabling harm.

While the paper does not provide a specific theory of how this work will reduce existential risk, it does make the general case for aligning existing AI systems. Specifically, it argues that current language models are highly and generally capable, making it more valuable to align them. They see significant overlap between short-term and long-term LM alignment goals, and are happy to see progress on one benefit the other. They propose a broad, qualitative vision in the hopes that others will join their work quantifying and making progress towards their goal for the field. 

The first three pages of the paper are a wonderful introduction to LM alignment motivations, you can read it [here](https://arxiv.org/pdf/2112.00861.pdf). The rest of the paper is technical; for a great summary, see [here](https://www.lesswrong.com/posts/oBpebs5j5ngs3EXr5/a-summary-of-anthropic-s-first-paper-3). 

Empirical Progress
==================

Robustness
----------

Robust AI systems perform well in a variety of circumstances, including (a) when responding to “out-of-distribution” inputs that did not appear in training data, and (b) when facing “adversarial attacks” that are deliberately constructed to provoke a model failure. For a more thorough overview of robustness, see Section 2 of [“Unsolved Problems in ML Safety” (Hendrycks et al., 2022)](https://arxiv.org/pdf/2109.13916.pdf). As one of the most widespread subfields of AI safety, robustness has historically focused on computer vision but is growing to include work on language models. 

### Red Teaming Language Models with Language Models (Perez et al., 2022) ([Arxiv](https://arxiv.org/pdf/2202.03286.pdf))

This paper introduces an automated technique for generating adversarial examples: attacking language models with other language models. The word “red teaming” refers to the cross-disciplinary method of improving systems by attacking them and exposing flaws. 

The process is straightforward. First, one language model generates prompts designed to induce undesirable outputs. Then another LM completes those prompts. Finally, an encoder-only classifier language model identifies undesirable completions. This setup can be used with many different language models. In this paper, the classifier identifies offensive dialogue produced by the generator. The authors also find instances of “data leakage”, where an LM directly repeats text that appeared in its training data. 

The red model generates prompts in several ways. First, the authors manually write prompts for the red model. Then a language model produces new prompts that mimic those manually written prompts. (This is termed a “few-shot” approach because the language model uses a few examples.) The authors also use a supervised approach, where the prompt generator model is fine-tuned to better mimic successful prompts; and a reinforcement learning (RL) approach that fine-tunes the prompt generator to maximize the offensiveness of resulting model outputs. 

This technique requires having a classifier that is already capable of identifying undesirable outputs. It is therefore less useful for the challenge of training a classifier from scratch (see Redwood Research’s project below), but more useful for auditing language models using our many existing classifier models. 

### High-Stakes Alignment via Adversarial Training (Ziegler et al., 2022) ([LessWrong](https://www.lesswrong.com/posts/A9tJFJY7DsGTFKKkh/high-stakes-alignment-via-adversarial-training-redwood), [Arxiv](https://arxiv.org/pdf/2205.01663.pdf))

For critical AI systems, even a small chance of failure can be catastrophic. Therefore, among other things, Redwood Research is building techniques to improve the worst-case performance of AI systems. See Buck Shlegeris’s [project description](https://www.alignmentforum.org/posts/k7oxdbNaGATZbtEg3/redwood-research-s-current-project#comments) and Paul Christiano’s [support](https://www.alignmentforum.org/posts/pXLqpguHJzxSjDdx7/why-i-m-excited-about-redwood-research-s-current-project) of the agenda. 

Daniel Ziegler added this context for Redwood’s motivations, quoted here in full: 

> An important background assumption (that we didn't focus on in the paper) is that we think the main failures we're worried about are alignment failures rather than capabilities failures. So talking about "critical AI systems" seems slightly misleading; we're not worried about a nuclear reactor control system failing in a rare situation because it's not smart enough, we're worried about an AI in a pretty arbitrary setting deceiving us / seeking power because it's **smart enough** to do that and we haven't figured out how to get it not to do that. Failures from misalignment both seem more worrying and more tractable (we certainly can't hope to make systems that are literally always perfect, and that's more of a capabilities question)

This particular paper uses a classifier language model ([DeBERTa V3 Large](https://arxiv.org/pdf/2111.09543.pdf)) to filter undesirable outputs from a generative language model ([GPT-Neo](https://zenodo.org/record/5297715#.YopngqjMK3A)). The undesirable outputs here are any completions of a paragraph that introduce injuries to beings in the paragraph. Avoiding injuries in generated text isn’t a particularly important task; it simply provides a setting for the challenge of developing a robust classifier. Classifiers like this could be used for monitoring the outputs of advanced systems to limit the potential harm of alignment failures such as deceptive alignment and inner misalignment. 

Training the classifier to identify injuries requires many examples of injurious and non-injurious prompt completions. To build an initial set of training examples, Redwood hired contractors from [Upwork](https://www.upwork.com/) and [Surge](https://www.surgehq.ai/) to label snippets of fanfiction completed by GPT-3. The classifier quickly learned to identify injuries in this dataset, missing only 2 injuries in 2447 test set examples. 

To improve out-of-distribution robustness, the authors began building adversarial examples. Contractors wrote their own prompts with the express goal of getting the model to produce an injury that would not be caught by the classifier. (For example, the contractors could write a prompt about a raging battle to see if the model would complete the story with an injury.) This process was manual at first, but it became quicker when the authors built software tools for constructing adversarial examples (described in detail [here](https://www.lesswrong.com/posts/A9tJFJY7DsGTFKKkh/high-stakes-alignment-via-adversarial-training-redwood#Our_most_powerful_attack__Tool_assisted_rewriting)).

Future work on worst-case performance in critical AI systems could expand on Redwood’s filtered generation approach by providing open source implementations of rejection sampling or new training datasets of outputs that should be avoided. Out-of-distribution robustness could also benefit from more tools for generating adversarial examples. 

### Adversarial Robustness

The two papers above are members of the popular subfield of adversarial robustness. Papers in this field prompt models with inputs designed to induce incorrect outputs and poor performance, thereby exposing model weaknesses and providing training data that can improve future robustness. These adversarial examples can be generated by hand or algorithmically using various methods. 

Here are several other papers on adversarial robustness for language models. 

*   “Adversarial NLI: A New Benchmark for Natural Language Understanding” (Nie et al., 2019) ([Arxiv](https://arxiv.org/pdf/1910.14599.pdf)).
    *   This paper provides a general framework for generating adversarial examples. A human writer generates a labeled example that they believe will be difficult for a model. The model makes a prediction. If the prediction is correct, the example was too easy, and is added to the training set. If the prediction is incorrect, the example successfully fooled the model. Another human verifies that the example is labeled correctly and, if so, the example is incorporated into the training, development, or test dataset for a future model. After generating a number of these adversarial examples, the model is retrained on the new data and the process begins again.
    *   This paper focuses on NLI, a particular task for language models. NLI requires a model to predict the relationship between a prompt and a deduction. For examples, see [here](https://nlp.stanford.edu/projects/snli/).
*   “Adversarial Examples for Evaluating Reading Comprehension Systems” (Jia & Liang, 2017) ([Arxiv](https://arxiv.org/pdf/1707.07328.pdf?source=post_page---------------------------)).
    *   This paper proposes two methods for appending strings to prompts that reduce performance on a question answering benchmark.
    *   The first method uses linguistic rules to write a sentence that answers a similar question with a random answer. For example, if the original question asks “What ABC division handles domestic television distribution?”, then the method might provide the adversarial sentence, “The NBC division of Central Park handles foreign television distribution.”
    *   A second method performs an algorithmic search to find any sequence of tokens that minimizes the model’s performance, whether the sequence is grammatically correct or not.
    *   Appending these adversarial strings to the original prompts of the SQuAD benchmark, the average F1 performance of sixteen different models falls from 75% to 36%.
*   “Universal Adversarial Triggers for Attacking and Analyzing NLP” (Wallace et al., 2021) ([Arxiv](https://arxiv.org/pdf/1908.07125.pdf)).
    *   Similar to Jia & Liang, 2017, this paper provides an automated method for generating “universal adversarial triggers.” When appended to any input prompt given to any model, these strings trigger the model to predict a specified target label.
    *   For example, one string reduces accuracy on the SNLI benchmark from 89.94% to 0.55%, and another causes GPT-2 to spew racist outputs given non-racial prompts.
    *   To generate these universal triggers, the method uses a “white box” approach to access model parameters and calculate gradients. (“Black box” methods would not have access to internal facts about the model.) While the gradient of a parameter is typically used to make an update that reduces loss on the true label, this adversarial approach updates inputs towards tokens that will make an arbitrary target label more likely. By iterating through many possible trigger strings combined with many potential input prompts, the method finds triggers which universally encourage the target output. This approach builds on [HotFlip](https://arxiv.org/pdf/1712.06751.pdf) and uses [beam search](https://d2l.ai/chapter_recurrent-modern/beam-search.html) to generate triggers of multiple tokens.
*   “BERT-ATTACK: Adversarial Attack Against BERT Using BERT” (Li et al., 2020) ([Arxiv](https://arxiv.org/pdf/2004.09984.pdf))
    *   This paper provides an automated method for generating adversarial examples by changing individual words in a prompt. It uses the BERT encoder-only model.
    *   First, they identify the most vulnerable words in a prompt. These are the words which, when replaced by a “mask”, result in the biggest drop in the probability of the true label. (A mask is simply the token “\[MASK\]”. BERT is trained to predict masked words in text.)
    *   The most vulnerable words are then iteratively replaced by other words that BERT predicts are likely to appear in their place. Once the prompt causes the model to predict the wrong label, the example is deemed successful and stored.
    *   This method successfully reduces the average accuracy on tested benchmarks from above 90% to below 10%. However, this evaluation assumes that replacing individual words does not change the true label of the prompt. Human evaluation might reveal that the automated changes are significant enough to warrant a different label.

### Prompt Engineering

The prompt given to a language generation model has a great influence on the model’s output. This is true even in cases where two prompts should ideally provide the same completion, such as asking the same question framed two different ways. Building prompts that improve LM generation performance is therefore a tractable research direction. Here are some papers on the topic:

*   “Pre-train, Prompt, and Predict: A Systematic Survey of Prompting Methods in Natural Language Processing” (Liu et al., 2021) ([Arxiv](https://arxiv.org/pdf/2107.13586.pdf)). Comprehensive overview of prompting.
*   “An Information-theoretic Approach to Prompt Engineering Without Ground Truth Labels” (Sorensen et al., 2022) ([Arxiv](https://arxiv.org/pdf/2203.11364.pdf)). An unsupervised technique that generates prompts to maximize the mutual information between the prompt and the prompt completion. This method helpfully does not require labeled examples of good prompts.
*   “Fantastically Ordered Prompts and Where to Find Them: Overcoming Few-Shot Prompt Order Sensitivity” (Lu et al., 2022) ([Arxiv](https://arxiv.org/pdf/2104.08786.pdf)). When examples are included in the prompt as part of a few-shot learning approach, the order of the examples can strongly affect the quality of the output. This paper provides a metric by which training examples can be ordered, which improves GPT-3 performance by 13% across 13 classification tasks.
*   “Toxicity Detection with Generative Prompt-based Inference” (Wang & Chang, 2022) ([Arxiv](https://arxiv.org/pdf/2205.12390.pdf)). Prompt engineering allows pretrained language models to detect toxic speech without any labeled examples of toxicity. This is an example of models supervising other models, where the same model will generate toxic outputs and can correctly identify that toxicity.

### Other Work

*   “Capturing Failures of Large Language Models via Human Cognitive Biases” (Jones et al., 2022) ([Arxiv](https://arxiv.org/pdf/2202.12299.pdf)). Shows that OpenAI’s Codex LM falls prey to common human cognitive biases including framing, anchoring, and the motte and bailey fallacy.
*   “TextAttack: A Framework for Adversarial Attacks, Data Augmentation, and Adversarial Training in NLP” (Morris et al., 2020) ([Arxiv](https://arxiv.org/pdf/2005.05909.pdf), [GitHub](https://github.com/QData/TextAttack)). Provides an open-source implementation of 16 adversarial attack techniques from the robustness literature. The package is built in four modular components to enable future work on each component. Built by a team of several undergraduates working with two PhD researchers.

Law
---

While laws that govern AI have received lots of attention from the field of AI policy, a smaller subfield with potential long-term importance attempts to build AI that understands our laws. Practically speaking, AI could be useful in assisting our legal processes with functionality such as summarizing documents, identifying relevant precedents, and aiding contract review. These practical applications have been the focus of the growing field of Legal AI. 

![](https://lh4.googleusercontent.com/0PYNAF2poV252DTdwaSMum7YK74qoNzrmmDxFAPohYKg0aj8Hiu2XvokML9JZSB_ONqS8SZYN6hOcTCrmh3MLX_XnBLV98oJT5Bsc3hHOnAW-ec9PRq8lcZZY8cCESob2X94eGltQWI1uniGew)

*From “A Survey on Legal Judgment Prediction: Datasets, Metrics, *

*Models and Challenges” (Cui et al., 2022) (*[*Arxiv*](https://arxiv.org/pdf/2204.04859.pdf)*)*

From a longtermist ethical perspective, laws are important because they encode complex human preferences and rules about acceptable behavior in the world. Language models that understand our legal system could therefore help AI make decisions that are aligned with human values. 

### Legal AI Overviews

Here are two good recent surveys of the legal AI field: 

*   “How Does NLP Benefit Legal System: A Summary of Legal Artificial Intelligence” (Zhong et al., 2020) ([Arxiv](https://arxiv.org/pdf/2004.12158.pdf)). This article identifies the dominant paradigms of legal AI research: first, embedding-based models such as large language models, and second, symbolic methods of legal reasoning. (Symbolic AI is less popular today than the large datasets and compute budgets of end-to-end deep learning, but it has achieved meaningful progress on legal AI.) It also reviews state-of-the-art performance on key tasks for legal AI including legal judgment prediction, similar case matching, and legal question answering.
*   “A Survey on Legal Judgment Prediction: Datasets, Metrics, Models and Challenges” (Cui et al., 2022) ([Arxiv](https://arxiv.org/pdf/2204.04859.pdf)). Detailed review of datasets, evaluation metrics, and state-of-the-art performance in legal judgment prediction. Excellent resource for finding new research opportunities; note that legal judgment prediction is only one of many important tasks for legal AI.

Neither of these surveys consider the alignment problem or take a longtermist ethical perspective. This perspective has been briefly covered in parts of Dan Hendrycks’ [MMLU](https://arxiv.org/abs/2009.03300) and [ETHICS](https://arxiv.org/abs/2008.02275) papers, but there exists no thorough overview of legal AI from a longtermist perspective. This seems like an important opportunity for future policy papers and research agendas. 

### Domain Specific Pretraining

One popular strategy for improving the performance of language models on domain-specific tasks is pretraining the model on documents from that domain. Several papers have improved performance on legal tasks through domain-specific pretraining: 

*   “LEGAL-BERT: The Muppets straight out of Law School” (Chaldakis et al., 2020) ([Arxiv](https://arxiv.org/pdf/2010.02559.pdf)). This paper uses three strategies for pretraining BERT to perform legal tasks. First, it uses the out-of-the-box BERT; second, it adapts the original BERT with additional pre-training on a corpus of legal documents; and third, it trains BERT from scratch on that same legal corpus. The corpus of legal documents consists of several hundred thousand documents of US and European legislation, caselaw, and contracts. These models achieve 0.8% - 2.5% improvement on the F1 statistic of various legal classification tasks.
*   “Measuring Massive Multitask Language Understanding” (Hendrycks et al., 2021) ([Arxiv](https://arxiv.org/pdf/2009.03300.pdf), [GitHub](https://github.com/hendrycks/test)). As part of the much larger MMLU benchmark for language models, the authors propose specific benchmarks for Professional Law and International Law. They fine-tune RoBERTa on 1.6 million case summaries from [Harvard’s Caselaw Library](https://case.law/), which improves performance on the Professional Law task from 32.8% to 36.1%.
*   “BERT Goes to Law School: Quantifying the Competitive Advantage of Access to Large Legal Corpora in Contract Understanding” (Elwany, Moore & Oberoi 2019) ([Arxiv](https://arxiv.org/pdf/1911.00473.pdf)). Fine-tuning BERT on a corpus of private legal documents improves F1 performance by 5.3% on a custom task of extracting the time horizon of a contract. Interestingly, this paper was published by legal tech startup [Lexion](https://www.lexion.ai/) and uses their private contract data.
*   “When Does Pretraining Help? Assessing Self-Supervised Learning for Law and the CaseHOLD Dataset of 53,000+ Legal Holdings” (Zheng et al., 2021) ([Arxiv](https://arxiv.org/pdf/2104.08671.pdf), [GitHub](https://github.com/reglab/casehold), [Hugging Face](https://huggingface.co/zlucia/legalbert)). The authors argue that the measured benefits of legal pretraining have been small because the evaluation tasks have not been challenging enough. They present CaseHOLD, a new evaluation task of multiple choice questions asking models to predict the holding of a case. These questions are built by extracting data from the [Harvard Caselaw Library](https://case.law/). Evaluated on the CaseHOLD task, moving from out-of-the-box BERT to the domain-pretrained LegalBERT improves accuracy in multiple choice prediction of case holdings from 62.3% to 69.5%.

Domain-specific pretraining has therefore provided meaningful but limited improvements on legal tasks. Future work is necessary to develop structured datasets, advanced training methods, and more challenging evaluation tasks in the legal domain. 

### CUAD: An Expert-Annotated NLP Dataset for Legal Contract Review (Hendrycks, Burns, Chen & Ball, 2021) ([Arxiv](https://arxiv.org/pdf/2103.06268.pdf))

Building new datasets is one of the core levers driving progress in machine learning, particularly in new specialized domains like legal AI. This paper introduces a new dataset for contract review. 

Annotated by human legal experts, the dataset highlights clauses within contracts that ought to be reviewed before signing the contract. Each clause is additionally tagged with the concern type, allowing models to learn which clauses are important and why. The benchmark is difficult for existing models: RoBERTa pretrained on 8GB of unlabeled contracts achieves an AUPR (area under the precision-recall curve) of 45%. 

Contract review is an economically important task where AI can assist human legal experts. Businesses including established players [Icertis](https://www.icertis.com/contract-management/ai-applications/) and [Kira](https://kirasystems.com/how-kira-works/contract-analysis/) as well as early-stage startups [Klarity](https://www.tryklarity.com/), [Della](https://www.linkedin.com/company/dellaai/people/), and [Claira](https://www.claira.io/our-team) are all working on AI assisted contract review. Developing commercially viable applications of tasks relevant to AI safety (in this case, developing contract review software to facilitate legal AI) can leverage resources and talent outside of the safety community to drive safety progress. 

Machine Ethics
--------------

### Aligning AI with Shared Human Values (Hendrycks et al., 2021) ([Arxiv](https://arxiv.org/pdf/2008.02275.pdf), [GitHub](https://github.com/hendrycks/ethics))

Current AI systems do not have a holistic conception of human ethics, despite their growing knowledge of the world and abilities to act within it. Natural language is a key medium for conveying diverse, detailed information about the world, including ethical judgements and discussions. Language models could therefore be a strong candidate for building AI with ethical understanding. 

This paper introduces the ETHICS benchmark, a dataset of more than 130,000 scenarios described in text and annotated with human moral judgements. Rather than creating models aimed at satisfying task preferences or reinventing moral principles from scratch, the authors take a normative ethics approach. They crowdsource examples from five different ethical systems: justice, deontology, virtue ethics, utilitarianism, and commonsense moral intuitions. 

The authors point out that existing work on AI safety often attempts to implement one or more of these ethical theories in the context of a specific task. For example:

*   Statistical fairness research implements theories of justice.
*   Rules-based approaches to safety implement deontology.
*   Reward learning assumes utilitarian ethics and attempts to learn human utility functions.
*   Work on empathetic chatbots (Rashkin et al., 2019) ([Arxiv](https://arxiv.org/pdf/1811.00207.pdf?fbclid=IwAR1Zvx7e3ry7mO3EaOQgo0KTzwRDgwJZGUnMO0Nx-YG9UZdxvHlm0uZl6D8)) and conservative agents (Turner et al., 2020) ([Arxiv](https://arxiv.org/pdf/1902.09725.pdf)) attempts to build AI systems that showcase a particular virtue, and could be integrated within a broader virtue ethics paradigm.

To complement these individual safety mechanisms, the authors support building AI that understands the broad strokes of human ethics in a variety of real-world situations. While the failures of existing AI systems might be addressable with individual solutions, progress in language models and AI agents could make a natural language understanding of ethics essential to aligning future systems. Beyond ethics, this dataset of natural language scenarios and human evaluations allows us to better understand the risks of language models misinterpreting human instructions or preferences. 

Examples are both generated by human contractors on MTurk and scraped from Reddit. To ensure the scenarios and labels are morally unambiguous, each example is relabeled by multiple people on MTurk, and only examples with a strong consensus are used in the benchmark. 

Particularly challenging examples are generated via two strategies. First, examples that are most often incorrectly classified by a baseline model are set apart as the Test and Test Hard sets, a best practice known as “adversarial filtration” (Bras et al., 2020) ([Arxiv](https://arxiv.org/pdf/2002.04108.pdf)). Second, the dataset includes contrastive examples (See (Kaushik, Hovy & Lipton, 2020) ([Arxiv](https://arxiv.org/pdf/1909.12434.pdf)) and (Gardner et al., 2020) ([Arxiv](https://arxiv.org/pdf/2004.02709.pdf))) in which slight differences in the input text lead to different output labels. 

The authors assess the performance of several baseline models on the benchmark. The models are all BERT-based classifiers with varying sizes and training algorithms. The models are fine-tuned on examples from the development set and evaluated on examples from the Test and Test Hard set. The best performing model chooses the correct answer in 71% of test cases and 48% of hard test cases. 

Here are several lines of potential future work; see Section 4 of the paper for more:

*   Ethical understanding could be implemented in chatbots and language agents. This line of work has been criticized by authors such as [Talat et al., 2021](https://arxiv.org/abs/2111.04158) who hope to avoid AI that makes ethically important decisions. Those considering this branch of machine ethics should be aware of those concerns, but might find the proliferation of decision-making AI unavoidable.
*   More difficult benchmarks of the same task should be built. Baseline models achieve a reasonable degree of accuracy on the ETHICS benchmark, meaning that more difficult sets of ambiguous or adversarial examples will be necessary in order to incentivize and measure further progress. These benchmarks should also consider other moral theories, such as those which prioritize bodily integrity or intent.
*   More diverse sources of moral judgements should be considered in future work. All examples in the ETHICS dataset are generated by English speakers in the United States, Canada, and Great Britain. Annotators from India show substantial disagreement with 6.1% of examples in the common sense morality section of this benchmark, indicating the importance of cross-cultural descriptive ethics.
*   While these examples are designed to be unambiguous, future work should also consider moral uncertainty and cooperation between moral theories. This could include calibrated ethical judgements.

### “When to Make Exceptions: Exploring Language Models as Accounts of Human Moral Judgment” (Jin et al., 2021) ([PDF](https://drive.google.com/file/d/1hB_yStLu52sGUYOVwq1aQ8O-6IeqR12g/view))

Rather than the “bottom-up” approach of learning moral intuitions from large datasets of labeled examples, language models can also be designed “top-down” to implement theories of ethics. For example, self-driving cars don’t learn about speed limits and stop signs solely by observation and experimentation; instead, they are programmed with explicit knowledge of traffic laws. Similarly, language models can be designed to use well-understood theories of human moral cognition. One key potential benefit of this approach is improving performance in situations that do not appear in the training data, which is essential for long-term alignment. 

This paper comes from an interdisciplinary team of cognitive scientists and computer scientists. Building upon some of the authors’ [previous published work](https://arxiv.org/abs/2201.07763), they argue that rules and exceptions to rules are fundamental to human moral cognition. This flexible observation holds true across various normative ethics theories and empirical studies of human morality. 

The paper first introduces the RBQA benchmark, or “Rule-Breaking Question Answering”, consisting of 153 textual descriptions of scenarios where a person considers breaking a rule. Rather than covering a wide range of common scenarios, the scenarios are written about one of three rules, and explore various hand-crafted circumstances that could motivate breaking the rule. The authors then survey hundreds of people to determine whether humans believe rule-breaking is permissible in each scenario. 

The authors then ask language models whether it is permissible to break the rule in each scenario. As a baseline, note that answering randomly provides the right answer 52% of the time, and always saying that rule-breaking is impermissible is accurate 60% of the time. Delphi++, a large language model fine-tuned on 1.7 million labeled data points of ethical decisions, provides the correct answer only 62% of the time, while OpenAI’s most recent InstructGPT achieves 65% accuracy. 

The authors then propose a new prompting strategy called Moral Chain of Thought (MoralCOT). Before asking whether a rule-breaking is permissible in a scenario, MoralCOT asks the model five questions, and includes the model’s answers to those questions in the prompt for future questions. The questions are:

1.  Does the action in the scenario violate any rule?
2.  What is the purpose for this rule?
3.  Who will be worse off after this happens, and by how much?
4.  Who will be better off after this happens, and by how much?
5.  In this case, do the benefits of breaking the rule outweigh the costs?

Using the MoralCOT strategy with InstructGPT improves state-of-the-art accuracy from 65% to 68% and F1 performance from 55% to 67%. The model still fails for various reasons such as not considering relevant parties to the situation, misestimating complex and non-monetary costs, and failing to recognize high-stakes scenarios such as when rule-breaking could save lives. Yet the results are encouraging, showing that designing moral cognition processes can improve performance in ethical judgments. 

### Related Work

*   “Do Multilingual Language Models Capture Differing Moral Norms” (Hammerl et al., 2021) ([Arxiv](https://arxiv.org/pdf/2203.09904.pdf)). Investigates whether language models trained on text from different languages learn different moral judgments. Doesn’t show many conclusive results, but an interesting question.
*   “The Moral Integrity Corpus: A Benchmark for Ethical Dialogue Systems” (Ziems et al., 2022) ([Arxiv](https://arxiv.org/pdf/2204.03021.pdf)). Provides a new dataset for evaluating ethical judgements in language models.
*   “What Would Jiminy Cricket Do? Towards Agents That Behave Morally” (Hendrycks et al., 2022) ([Arxiv](https://arxiv.org/pdf/2110.13136.pdf)). A benchmark evaluation for the ethical behavior of text-based agents.

Related Resources
=================

The goal of this piece is to provide a useful starting point for learning about language model safety. The field has hundreds or thousands of relevant papers, meaning this summary can only be a starting point for more independent reading and research. For those interested in learning more about language model alignment, here are some other interesting resources:

*   “Ethical and social risks of harm from Language Models” (Weidinger et al., 2021) ([Arxiv](https://arxiv.org/pdf/2112.04359.pdf))
*   “On the Opportunities and Risks of Foundation Models” (Bommasani et al., 2021) ([Arxiv](https://arxiv.org/pdf/2108.07258.pdf?utm_source=morning_brew))
*   “Finding and Fixing Undesirable Behaviors in Pretrained Language Models” (Perez, 2022) ([Thesis](https://ethanperez.net/thesis.pdf))

*Thank you to everybody who has provided feedback on this article, including Daniel Ziegler, Michael Chen, Dan Hendrycks, Thomas Woodside, and Zach Perlstein-Smith, as well as everybody who has engaged with me on AI safety over the years. Thanks in particular to the FTX Future Fund Regranting Program for making my work on this topic possible. This article and all errors and omissions are my own. *