Venue: NAACL 2024

# Strings from the Library of Babel: Random Sampling as a

Strong Baseline for Prompt Optimisation

 Yao Lu\({}^{\dagger}\)   Jiayi Wang\({}^{\dagger}\)    Raphael Tang\({}^{\ddagger}\)   Sebastian Riedel\({}^{\dagger}\)   Pontus Stenetorp\({}^{\dagger}\)

\({}^{\dagger}\)University College London \({}^{\ddagger}\)Comcast AI Technologies

{yao.lu,s.riedel,p.stenetorp}@cs.ucl.ac.uk

ucabj45@ucl.ac.uk     raphael_tang@comcast.com

###### Abstract

Recent prompt optimisation approaches use the generative nature of language models to produce prompts - even rivalling the performance of human-curated prompts. In this paper, we demonstrate that randomly sampling tokens from the model vocabulary as "separators" can be _as effective_ as language models for prompt-style text classification. Our experiments show that random separators are competitive baselines, having less than a 1% difference compared to previous self-optimisation methods and showing a 12% average relative improvement over strong human baselines across nine text classification tasks and eight language models. We further analyse this phenomenon in detail using three different random generation strategies, establishing that the language space is rich with potentially good separators, with a greater than 40% average chance that a randomly drawn separator performs better than human-curated separators. These observations challenge the common assumption that an effective prompt should be human readable or task relevant and establishes a strong baseline for prompt optimisation research.1

Footnote 1: Our implementation is publicly available at [https://github.com/yaolu/random=prompt](https://github.com/yaolu/random=prompt)

+
Footnote †: footnotemark:

## 1 Introduction

Pre-trained large language models (PLMs, Peters et al., 2018; Devlin et al., 2019; Liu et al., 2019; Radford et al., 2019; Touvron et al., 2023, 2023) have demonstrated remarkable performance when conditioned with appropriate context Petroni et al. (2019, 2020); Jiang et al. (2020); Shin et al. (2020); Davison et al. (2019). For instance, when given a query along with the phrase "Let's think step by step," such models are capable of solving reasoning tasks Kojima et al. (2022); Wei et al. (2022). These special tokens, often called "_separators_", are usually placed at the end of the input data or at the beginning of the output (Table 1).

Recent work found that including thinking-style separators such as "take a deep breath" can significantly enhance reasoning performance Yang et al. (2023). Similarly, another study discovered that simply using "SOLUTION:" is even more effective Fernando et al. (2023). These findings suggest that the language space for separators might still be under-explored, with many effective options yet to be identified. A common framework employed in this line of research involves starting with thinking-style separators, using a language model to generate alternatives, and then selecting effective separators based on certain criteria Zhou et al. (2022); Yang et al. (2023); Fernando et al. (2023); Guo et al. (2023). This optimisation-style framework has shown promise in automating the exploration of the language space, which addresses the challenge of relying on human expertise to develop task-specific separators.

Most existing methods, particularly those applied to reasoning tasks, assume that effective separators should be closely related to the task or con

Figure 1: Illustration of our approach when searching for good separators for a sentiment classification task. Unlike relying on human knowledge or using external large language models to suggest alternatives, we find that randomly selected separators from the vocabulary can also yield good performance.



text (Fernando et al., 2023; Guo et al., 2023; Shi et al., 2022). However, perhaps counter-intuitively, we find that a performant separator does not necessarily have to be task-relevant or even coherent. Sometimes, even tokens chosen at random from the vocabulary can improve performance as much as semantically meaningful phrases.

Footnote 1: [https://github.com/facebook/tree-master/tree-master](https://github.com/facebook/tree-master/tree-master)

As shown in Figure 1 and Table 1, we can achieve similar performance to that of human-optimised prompts by randomly selecting separators from the vocabulary. This suggests that random separators can serve as a competitive baseline, sometimes even matching the performance of previous methods Zhou et al. (2022); Kojima et al. (2022); Yang et al. (2023); Guo et al. (2023) for prompt-style text classification tasks. Our exploration across seven different models further shows that this behaviour is universal across both pre-trained and instruction-tuned language models (Table 6), and seems to be a fundamental characteristic of in-context learning Brown et al. (2020).

We further analyse this phenomenon with three random separator generation strategies, revealing that there are many performant separators in the language space, suggesting that previous research underestimated the effectiveness of randomised prompts outside of reasoning tasks. This observation breaks common assumptions such as that good separators need to be task relevant, coherent, and context dependent Shin et al. (2020); Shi et al. (2022). Experimental results show that using random separators attains a \(12\%\) average relative improvement across nine classification tasks on eight language models, compared to human-curated separators. To summarise, our contributions are as follows:

1. We show that random separators can be as effective as human-curated prompts for prompt-style text classification.
2. We analyse three randomised separator generation strategies, which do not require an instruction-following language model, and show on-average a \(12\%\) relative improvement over human baselines.
3. We find that random separators are as competitive as previously proposed language model approaches to generate alternative prompts, suggesting that their effectiveness appear greater than what it would have appeared given this strong random baseline.

## 2 Random Separator Optimisation

We propose a random separator optimisation framework (Figure 2) to find effective separators based on random sampling. The framework consists of three components: 1) random separator generation, 2) separator evaluation, and 3) separator selection.

### Definition of Separator

The term "separators" is inspired by the well-known BERT [SEP] token in order to differentiate from general wordings such as "suffix" or "prefix". We use this term to provide readers with better semantics and also to avoid ambiguity.

### Random Separator Generation

In this work, we seek to answer the following questions which relate to common assumptions adopted in prompt optimisation research:

* Should effective separators be task-relevant, or should they be closely tied to the existing context information?
* To what degree are language models needed for prompt optimisation?

To answer these questions, we propose three strategies for generating random separators from language model free and context-free, to language model dependent and context relevant. The core difference between these three random strategies are summarised in Table 2, with a more detailed illustration provided in Table 3.

\begin{table}
\begin{tabular}{l l} \hline \hline  & Prompt Examples \\ \hline Human & This is a good movie. Answer positive \\ Random & This is a good movie. [0.478 positive \\ \hline \hline \end{tabular}
\end{table}
Table 1: Examples of prompts used in our evaluation, where the highlighted text are the separators.

\begin{table}
\begin{tabular}{c c c} \hline \hline  & Language Model & Task Relevant \\ \hline Random Vocabulary & ✗ & ✗ \\ Random w/o Context & ✓ & ✗ \\ Random with Context & ✓ & ✓ \\ \hline \hline \end{tabular}
\end{table}
Table 2: Random generation methods 

Sampling randomly across the vocabulary.AutoPrompt Shin et al. (2020) suggests that effective separators may appear to be random strings, showing the potential of identifying a good separator within the random space. To investigate this, we design an approach to generate random separators that are context-free, task-agnostic, and do not rely on any language model for their generation. Essentially, we select random tokens from the vocabulary until a predetermined string length limit is reached.

Sampling from a language model without context.This method involves drawing samples from the language model's prior distribution, a process that is both context-free and task-agnostic. We employ this random generation method to evaluate whether separator coherence contributes to performance, especially when compared to random samples at the vocabulary level.

Sampling from a language model with context.The creation of task-relevant separators may enhance performance. For instance, incorporating thinking-style phrases in a reasoning task has proven highly effective. In OPRO Yang et al. (2023), the authors highlight that including samples from the training data in the meta-prompt leads to consistent improvements. Thus, to assess the impact of task relevance on separator generation, we integrate a few training samples from the training corpus into the meta-prompt to refine the semantic space of the separator.

### Separator Evaluation

We demonstrate the evaluation process in Figure 2. In line with prior work Fernando et al. (2023); Yang et al. (2023), a small set of labelled data, denoted as the training corpus \(T=\{(x_{i},y_{i})\},i=1,...,n\), is available. Here, \(x_{i}\) and \(y_{i}\) represent the sentence and label of the \(i^{\text{th}}\) sample, respectively. We also define a transformation \(\mathcal{T}\), which maps label \(y_{i}\) to text. In contrast to supervised learning settings that require a large volume of data for training, we only need a limited set of examples.2 To evaluate a given separator \(s\), we perform string concatenation (\(\oplus\)) of the each input sentence from the training corpus \(T\) with the separator. As part of in-context learning settings, where demonstrations may be necessary for some tasks, we also take into account a context \(c\), which has identical structure to the linearised sequence. For each data point \((x_{i},y_{i})\) in \(T\), we prompt the pretrained language model to generate the predicted label \(\hat{y}_{i}=\operatorname*{argmax}_{v\in V}P(v|c\oplus x_{i}\oplus s;\theta)\), where \(\theta\) represents the parameters of the pretrained language model and \(V\) denotes the vocabulary space. For a classification task, we compute the classification accuracy as the corresponding separator score, denoted by \(m\). It is worth noting that the metric does not necessarily need to be differentiable, allowing for the direct optimisation of discrete metrics such as word overlap ratio, etc.

Footnote 2: For all experiments, the training set size is \(n=64\), unless explicitly mentioned otherwise.

### Separator Selection

Despite the random separator generation steps being independent, we retain the term "iteration" in our methodology. This allows for a consistent comparison with other methods that use an iteration

Figure 2: Our random separator optimisation procedure.

 

sensitive meta-prompt. During the iteration process, we evaluate the generated prompt and keep track of the most effective separators at each step. The sampling continues until we reach a predefined sampling budget limit, denoted as \(k\). By the end of the training process, we accumulate a set of separators3 and their corresponding scores, represented as \(S=\{(s_{i},m_{i})\},i=1,...,k\). The separator that yields the highest score in this set is then selected for evaluation on the test set.

Footnote 2: We generate up to 160 separators in all experiments.

## 3 Experimental Setup

### Datasets and Models

In line with previous studies Gao et al. (2020); Zhao et al. (2021); Lu et al. (2022), we use nine text classification datasets (Table 4). For training we use 64 samples per dataset and for evaluation we use the sub-sampled test set from Lu et al. (2022).

In contrast to previous work, our random separator optimisation methods do not require an instruction-tuned language model. This allows us to test our methods using both standard pre-trained language models and instruction-tuned language models. As detailed in Table 5, our experiment uses four pre-trained language models and four instruction-tuned language models, in total eight models with varying structure and training data.

### Optimisation Settings

Separator generation methods.As detailed in Section 2, we have proposed three different random separator generation approaches. For comparative analysis, we include the OPRO Yang et al. (2023) method in our study. We also adapt OPRO's metaphor by omitting the instructional text, creating an in-context learning variant (OPRO-ICL). This allows fair comparison between random generation and other methods on non-instrucationally tuned models. We also compare our methods against two human-level prompt optimisation methods, MI Zhang et al. (2023) and NI Mishra et al. (2021), as well as two automatic prompt optimisation methods, APE Zhou et al. (2022) and EvoPrompt Guo et al. (2023), under our experimental settings4 described in Guo et al. (2023). In total, we employ nine distinct separator generation methods as baselines in our main experiment (Tables 6 and 7).

Baseline separators.To better understand how much improvement separator optimisation can achieve, we use the human curated separator "Answer:" and random strings such as "Foo Bar"5 and zero-shot chain-of-thoughts (ZS-CoT) Kojima et al. (2022), "Let's think step by step", as baseline separators.

Initialisation.The choice of a starting point does not affect random methods. In cases where a metamorphic requires a starting point, such as in OPRO, we use "Answer:" as the starting point.

Prompting settings.We use one-shot examples as context to prompt language models during both training and test stages. When context is necessary for separator generation, we provide three randomly chosen training examples. We set the generation temperature to 1.0 and use a temperature of 0.0 for prompt-based text classification. For training of OPRO and OPRO-ICL, we set a maximum of 40 optimisation steps and generate four candidate separators each step. For our random methods, we generate 160 candidate separators and select the best one for evaluation.

Footnote 5: Here, “Foo Bar” represents a random string sampled from the vocabulary and not the literal usage of this exact string.

## 4 Results and Discussion

We report our results in Table 6 and demonstrate the effectiveness of randomly sampled separators across all tasks. In addition, we compare four additional baseline methods in Table 7 using the experimental settings described by Guo et al. (2023).

### Random Separators are Strong Baselines

Unnatural separators are effective.To our surprise, we find that even separators chosen at random from the vocabulary can substantially improve performance. Table 6 shows that the _Random Vocabulary_ method yields, on average, a 10% relative improvement across nine benchmark datasets compared to human-curated separators. _Random Vocabulary_ shows only marginal differences (less than 1% difference) compared to self-optimisation style methods Yang et al. (2023); Zhou et al. (2022). For evolutionary methods Guo et al. (2023), _Random Vocabulary_ shows a 3.4% difference from the best EvoPrompt result (Table 7), with the most significant drop (2.1%) occurring on the SubJ dataset.

Since our goal is not to produce a state-of-the-art method, but rather to establish a strong baseline, 

the performance of _Random Vocabulary_ suggests that previous progress and the weight of contributions in prompt optimisation might be overestimated. Notably, our method does not depend on a language model for generation (Table 2). This result challenges the common practice in prompt optimisation where large language models are used for creating alternative prompts.

Natural language separators are effective, but may not be essential.Human creation of separators often takes coherence into account. For instance, in sentiment classification, a model might struggle to predict "positive" or "negative" due to high sequence perplexity, but introducing a separator like "It is positive" can align predictions with the model's pre-training objective. Given the surprisingly competitive quality of _Random Vocabulary_, we further explore the potential benefits of coherence towards prompt optimisation. We design another simple strategy, _Random w/o Context_, which samples from the language model's prior to generate natural language phrases as separators. The key difference between _Random w/o Context_ and _Random Vocabulary_ is that the former consists of natural language phrases, whereas the latter may not. Both methods generate separators that are statistically unlikely to be relevant to the task and context.

Experimental results show that the _Random w/o Context_ is significantly better than human baselines (12% relative improvement) and nearly on par with previous state-of-the-art prompt optimisation methods (less than a 1% difference). This suggests that _Random w/o Context_ is also a simple but strong baseline for prompt optimisation. When comparing the natural and unnatural separators, our analysis shows a mere 0.5% relative difference between _Random Vocabulary_ and _Random w/o Context_. Such a small margin suggests that, while the _Random w/o Context_ approach is competitive, coherence does not appear to be a critical factor.

Task information in separator generation provides slight improvements._Random with Con

\begin{table}
\begin{tabular}{l c r l} \hline \hline Dataset & \# of Classes & Arg. Len. & Balanced \\ \hline SST2 [36] & 2 & 12.4 & ✓ \\ SST5 [36] & 5 & 23.1 & ✗ \\ MR [79] & 2 & 25.7 & ✓ \\ CR [80] & 2 & 22.1 & ✓ \\ MPQA [20] & 2 & 3.9 & ✓ \\ Subj [78] & 2 & 28.9 & ✓ \\ TREC [20] & 6 & 11.6 & ✗ \\ AGNwx [34] & 4 & 53.8 & ✓ \\ DBPedia [34] & 14 & 65.5 & ✓ \\ \hline \hline \end{tabular}
\end{table}
Table 4: Statistics of evaluation datasets, average length is calculated based on GPT-2 sentence-piece length.

\begin{table}
\begin{tabular}{p{113.8pt} p{113.8pt} p{113.8pt}} \hline \hline  & Description & Prompt for Generating New Separators \\ \hline Random Baseline [16] & Random string without optimisation steps & - \\ Human Baseline [16] & Use “Answer.” as it is widely used & - \\ ZSCoT [14] & Think-style phrase & - \\ \hline OPRO [26] & The meta-prompt in OPRO consists of a natural language problem description and instructions to generate new solutions based on previously found solutions. & [Instructions] I have some texts along with their ... [ Historical Solutions] text: think stepwise score: 55 ... [ Instructions] The following exemplars show ... [Context] should not be missed <INS>positive ... [ Instructions] Write your new text that is different ... text: [to be prompted] \\ \hline OPRO-ICL & We remove all instructions from OPRO to create an in-context learning variant. & [ Historical Solutions] text: think stepwise score: 55 ... [ Context] should not be missed <INS>positive ... [ To be prompted] \\ \hline Random Vocabulary & Randomly sample tokens across vocabulary to generate separators. & [to be sampled] [such as ”!@$5\%\textbackslash{}^k**”] \\ \hline Random w/o Context & Draw samples from LLM’s prior distribution. & [to be prompted] \\ \hline \multirow{3}{*}{Random with Context} & Propning language model with few examples as context. Similar to OPRO [26], we use three randomly sampled examples from training data as context. & [Context] should not be missed <INS>positive curiously depressing <INS>negative text: [to be prompted] \\ \cline{1-1} \cline{2-2} \cline{3-3} \multicolumn{1}{c}{} & \multicolumn{1}{p{113.8pt}}{} & \multicolumn{1}{p{113.8pt}}{} \\ \end{tabular}
\end{table}
Table 3: Separator generation methods used for our main experiment. Text wrapped with square brackets are not included in prompt.

\begin{table}
\begin{tabular}{p{113.8pt} p{113.8pt} p{113.8pt}} \hline \hline Model & \# of Parameters & Instruction Tuned \\ \hline GPT2 Large [21] & 0.8B & ✗ \\ GPT2 XL [21] & 1.5B & ✗ \\ Mistral 7B [34] & 7B & ✗ \\ Mitarll 7B Insert [34] & 7B & ✓ \\ Lima-Alvarez 7B [20] & 6.7B & ✓ \\ Llamanza 7B [20] & 6.7B & ✗ \\ Llamanza 7B Chatworth et al. [20] & 6.7B & ✓ \\ ChaffPT (GPT-3.5 Turbo, 0613 version) & – & ✓ \\ \hline \hline \end{tabular}
\end{table}
Table 5: Language models used in experiments.

 





_text_ imposes task-relevance constraints by sampling from a language model conditioned on training samples. We observe, though marginal, consistent improvements of including context information for prompt optimisation. Specifically, the _Random with Context_ method achieves a relative improvement of 0.3% over _Random w/o Context_ and 0.9% over _Random Vocabulary_. Nevertheless, given the significant gains that _Random Vocabulary_ achieves over human baseline (10%), the incremental gains from adding task information are relatively minor.

### Random Sampling is a Strong Prompt Optimiser

**Random separator generation methods are comparable to instruction-based approaches.** OPRO and its in-context learning variant achieve the top average performance for four out of seven models. However, the advantage is minimal, with a 0.1% average performance difference compared to random methods. It appears that instruction-based methods might be randomly encountering good separators throughout the optimisation process.

Instruction-tuned models are not essential for proposing separators.Previous prompt optimisation work heavily rely on a language model to suggest alternatives, and they make a strong assumption that only instruction-tuned models are able to differentiate good and bad prompts. However, our observation indicates that instruction-tuned models are not essential for proposing the separators. As shown in Table 6, OPRO is able to achieve reasonable performance, even for the smaller GPT2 family models. It is worth noting that, given the linguistic complexity of the OPRO-style meta prompt, a GPT2 model is unlikely to "understand" it [45]. Furthermore, we do not observe a significant increase when using instruction-based model for proposing separators.

## 5 Analyses

### Language Space is Rich with Potentially Good Separators.

We find that different approaches can discover distinct separators while yielding similar performance, as shown in Table 8. This prompts a natural question: how many effective separators exist? For simplicity, we deem any separator effective if it outperforms a human-curated separator such as "Answer:". To investigate this question, we calculate the percentage of effective random separators based on all data points6 from the main experiment. Table 9 shows that our random baseline has on average a 40% chance to draw a separator that is better than the human baseline. This suggests that in the language space, there are more performant separators than we previously expected.

Footnote 6: Approximately 10,000 separators.

### Are Performant Random Separators Transferable?

In this section, we study whether performant separators discovered by random approaches are transferable across different tasks and contexts.

\begin{table}
\begin{tabular}{l c c c c c c c} \hline  & M & N & MF & Evo & Evo & Random & Random & Random \\  & & Phone-ID & Person-ID & Person-ID & Person-ID & Person-ID & Person-ID \\ \hline SST:1 & 93.7 & 92.9 & 94.0 & 94.8 & 94.8 & 93.7 & 94.2 & 94.4 \\ CR & 91.4 & 90.9 & 90.5 & 91.4 & 91.2 & 91.1 & 90.2 & 91.0 \\ MR & 88.8 & 96.9 & 90.2 & 90.4 & 89.4 & 89.6 & 90.3 \\ SNF:4 & 42.9 & 48.6 & 47.0 & 48.2 & 49.4 & 41.0 & 37.1 & 45.5 \\ AGNRes & 70.6 & 48.9 & 71.2 & 73.3 & 73.4 & 76.5 & 80.6 & 79.5 \\ TRC & 50.6 & 55.0 & 59.6 & 64.4 & 63.8 & 61.4 & 57.6 & 66.8 \\ SubJ & 49.8 & 82.6 & 63.7 & 77.6 & 67.9 & 62.6 & 69.0 & 64.7 \\ AVG. & 71.1 & 68.2 & 73.8 & 77.1 & 75.9 & 73.7 & 74.0 & 76.0 \\ \hline \end{tabular}
\end{table}
Table 7: Prompt performance on the Alpaca-tuned LLaMA model. We compare with two human-level prompt optimisation methods, MI [22] and NI [16], and two automatic prompt optimisation methods, APE [23] and EvPrompt [45].

\begin{table}
\begin{tabular}{l l l} \hline \hline  & Random & Random & Random \\  & Vocabulary & w/o Context & with Context \\ \hline GPT2-large & 37.1\% & 20.4\% & 51.2\% \\ GPT2-XL & 70.6\% & 42.6\% & 48.3\% \\ ILAMA2 7B & 66.1\% & 47.2\% & 49.6\% \\ ILAMA2 chat & 21.4\% & 14.6\% & 13.9\% \\ \hline \hline \end{tabular}
\end{table}
Table 8: Performance scoreered in the training process on AGNs using LLaMA2 7B, we report the accuracy score over the training set.

\begin{table}
\begin{tabular}{l c c} \hline \hline Strategy & Separator & Score \\ \hline OPRO & The new text is the following: & 92.2 \\ OPRO-ICL & 0e:57 & 92.2 \\ Random Vocabulary & obligedv@u442iv@438v@ud435Circr song & 92.2 \\ Random w/o Context & Home Business New v2018 & 92.2 \\ Random with Context **+Sdr** – The Wall Street & 92.2 \\ \hline \hline \end{tabular}
\end{table}
Table 9: Chance of random separators outperforming the human baseline “Answer :” on the AGNews dataset.

 

Cross-task transferability.We use separators with the highest accuracy from each task (Table 11) and apply them to different tasks. According to Table 10, we do not observe high transferability across tasks; for example, a performant prompt for SST2 has almost random-guessing performance on SST5, and vice versa. This is within our expectations, as these random prompts are optimised and selected for a particular task. Notably, even widely used human-curated separators exhibit similar transferability scores (59.0% versus 59.4% in average score) across tasks to random methods.

Cross-context transferability.Given the limited cross-task transferability of separators, we further study whether performant random separators are transferable when the context changes7 within a fixed task. We discover that random separators exhibit a degree of transferability and are significantly better than human-curated ones (73.4% versus 50.6%). Surprisingly, for this task, human-curated prompts perform even worse than the average random prompt, which matches with our observations in Section 5.1. Overall, our random strategies offer considerable flexibility in discovering task-wide performant separators.

Footnote 7: The term “context” here is also referred to as “demonstrations” in in-context learning. In our experiments, we use one-shot examples as context to guide the output label space for classification tasks.

### Beyond Text Classification Tasks

In previous sections, we have mainly showed that random sampling is a strong baseline for classification tasks across nine classification datasets over eight different models, revealing that the oversensitivity of LLMs is still a notable issue, and it is a fundamental characteristic of in-context learning.

To verify whether such random methods have similar patterns, and are strong baselines for generative reasoning tasks, we apply our "random sampling over vocabulary" method to GSM8K Cobbe et al. (2021), a mathematical reasoning dataset.

Similar to the previous experimental setup, we sample up to 160 different random separators, and

\begin{table}
\begin{tabular}{l c c c c c c c} \hline \hline  & **\#1** & **\#2** & **\#3** & **\#4** & **\#5** & Avg. \\ \multicolumn{5}{c}{Best Human-level Prompt} \\ Answer : & 43.8 & 54.7 & 57.8 & 43.8 & 53.1 & 50.6 \\ \hline Average Separators, Random Vocabulary & & & & & & \\ Avg. Foo Bar & 55.7 & 55.6 & 63.2 & 61.9 & 53.3 & 57.9 \\ \hline Best Separator, Random Vocabulary & & & & & & \\ n1 Best Sep. & 79.7 & 81.3 & 81.3 & 68.8 & 53.2 & 72.9 \\ n2 Best Sep. & 71.9 & 78.1 & 79.7 & 64.1 & 73.4 & 73.4 \\ n3 Best Sep. & 71.9 & 60.9 & 82.8 & 70.3 & 76.6 & 72.5 \\ n4 Best Sep. & 76.6 & 73.4 & 67.2 & 82.8 & 57.8 & 71.6 \\ n5 Best Sep. & 71.9 & 67.2 & 71.9 & 70.3 & 79.7 & **72.2** \\ \hline \hline \end{tabular}
\end{table}
Table 12: Random separator context transferability test on GPT2-XL. We choose the best separator from different contexts of the AGNews dataset; then compute its accuracy across other contexts for the same AGNews training set. AVG. Foo Bar represents the average performance of 160 randomly sampled separators.

\begin{table}
\begin{tabular}{l 

then perform selection and evaluate their performance over the subset of test data. For this task-specific setup, we use 5-shot and majority voting@1 on the Mistral 7B model Jiang et al. (2023), and report results on four different random seeds8, as shown in Table 13.

Footnote 8: We change the demonstration examples for each seed.

CoT is only slightly better than average random separators.Surprisingly, for the few-shot mathematical reasoning task, thinking-style phrases could only be slightly better than random separators. On average, CoT attains an accuracy of 38.3 and the average of random separators is 37.8. This suggests that the gains of manual prompt optimisation are sub-optimal.

CoT shows high variance in quality across different examples.As shown in Table 13, we observe that the language model is sensitive to different sets of demonstrations across all methods. The most widely used human-derived chain-of-thought prompt ("let's think step by step") results in the highest variance, with over a 17% relative performance gap between the best and worst set of demonstrations. On the other hand, our random sampling approach yields a 9% relative difference, suggesting better robustness.

Random separators are still a strong baseline for generative reasoning tasks.Our best random separators reach an average accuracy of 47.3, a 23% relative increase in accuracy over the CoT baseline. This aligns with our main findings derived from the classification tasks (Table 6). It is conceivable that for complex generative tasks, the language space is abundant with potentially good separators.

## 6 Related Work

Automatically discovering effective prompts remains a challenging research problem because of the complexity of the search space. One direction is continuous prompt tuning Qin and Eisner (2021); Lester et al. (2021); Liu et al. (2023), which involves adding a set of smaller tunable parameters to pre-trained language models. An alternative approach is to optimise discrete token spaces. Shin et al. (2020) showed that gradient information at the embedding layer can guide the discovery of more effective prompts. According to their research, unnatural prompts can also result in good performance, which matches our observations. In spite of the efficiency of using gradient information, such a method, which heavily relies on the availability of language models, imposes some restrictions on certain types of models. An alternative direction is black box search. To simplify language space optimisation, Prasad et al. (2023) introduced a set of operations, such as add/delete/replace tokens. APE Zhou et al. (2022) showed that generating some alternatives and then selecting and rephrasing them could also provide effective solutions. Similarly, Xu et al. (2022) used evolutionary methods to optimise the search process. Recently, Yang et al. (2023) demonstrated that we can teach language models to learn the pattern of good prompts using human-written meta prompts. EvoPrompt Guo et al. (2023) showed how we can formulate the evolutionary process in meta-prompt. Fernando et al. (2023) further demonstrated how we can improve the meta-prompt using language models, making the whole framework completely automatic without relying on the internal state of language models.

## 7 Conclusion

We find that random separators, even those selected at random from vocabulary, could be as effective as previously discovered state-of-the-art prompts. In addition, we conduct research on three different types of random separators, which demonstrated that these random separators do not require instruction-tuned models, could provide a 12% relative improvement as compared to human baselines, and are on par with a self-optimising approach involving complex meta-prompt engineering.

### Limitations

While we have done our utmost to explore randomly generated prompts, a limitation of this work is that we mainly evaluate our approaches on text classification tasks. However, based on our experimental results in the mathematical generative task (Section 5.3), our findings are still empirically sound. We will leave a more comprehensive evaluation of generative tasks as future work.

## Acknowledgements

We thank Jean Kaddour for his valuable feedback. Pontus Stenetorp would like to acknowledge the helpful proofing feedback from several viewers while finalising the submission. This work is supported by Microsoft Research via Accelerate Foundation Models Research Grant 



## References

* B. Brown, B. Mann, N. Ryder, M. Subbiah, J. Kaplan, P. Dhariwal, A. Neelakantan, P. Shyam, G. Sastry, A. Askell, et al. (2020)Language models are few-shot learners. arXiv preprint arXiv:2005.14165. Cited by: SS3.
* K. Cobbe, V. Kosaraju, W. Bavarian, M. Chen, H. Jun, L. Kaiser, M. Plappert, J. Tworex, J. Hilton, R. Nakano, et al. (2021)Training verifiers to solve math word problems. arXiv preprint arXiv:2110.14168. Cited by: SS1.
* J. Davison, J. Feldman, and A. M. Rush (2019)Commonsense knowledge mining from pre-trained models. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pp. 1173-1178. Cited by: SS1.
* J. Devlin, M. Chang, K. Lee, and K. Toutanova (2019)BERT: pre-training of deep bidirectional transformers for language understanding.. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), Vol. , pp. 4171-4186. External Links: Document Cited by: SS1.
* C. Fernando, D. Banarse, H. Michalewski, S. Osindero, and T. Rocktaschel (2023)Promptbreeder: self-referential self-improvement via prompt evolution. arXiv preprint arXiv:2309.16797. Cited by: SS1.
* T. Gao, A. Fisch, and D. Chen (2020)Making pre-trained language models better few-shot learners. arXiv preprint arXiv:2012.15723. Cited by: SS1.
* Q. Guo, R. Wang, J. Guo, E. Li, K. Song, X. Tan, G. Liu, J. Bian, and Y. Yang (2023)Connecting large language models with evolutionary algorithms yields powerful prompt optimizers. arXiv preprint arXiv:2309.08532. Cited by: SS1.
* M. Hu and B. Liu (2004)Mining and summarizing customer reviews. In Proceedings of the tenth ACM SIGKDD international conference on Knowledge discovery and data mining, pp. 168-177. Cited by: SS1.
* A. Q. Jiang, A. Sablayrolles, A. Marsch, C. Bamford, D. Singh Chaplot, D. de las Casas, F. Bressand, G. Lengyel, G. Lample, L. Saulnier, et al. (2023)MISTAI 7B. arXiv preprint arXiv:2310.06825. Cited by: SS1.
* Z. Jiang, F. F. Xu, J. Araki, and G. Neubig (2020)How can we know what language models know?. Transactions of the Association for Computational Linguistics8, pp. 423-438. Cited by: SS1.
* T. Kojima, S. S. Gu, M. Reid, Y. Matsuo, and Y. Iwasawa (2022)Large language models are zero-shot reasoners. Advances in neural information processing systems35, pp. 22199-22213. Cited by: SS1.
* B. Lester, R. Al-Rfou, and N. Constant (2021)The power of scale for parameter-efficient prompt tuning. arXiv preprint arXiv:2104.08691. Cited by: SS1.
* X. Liu, Y. Zheng, Z. Du, M. Ding, Y. Qian, Z. Yang, and J. Tang (2023)GPT understands, too. AI Open. Cited by: SS1.
* Y. Liu, M. Ott, N. Goyal, J. Du, M. Joshi, D. Chen, O. Levy, M. Lewis, L. Zettlemoyer, and V. Stoyanov (2019)Roberta: a robustly optimized bert pretraining approach. arXiv preprint arXiv:1907.11692. Cited by: SS1.
* Y. Lu, M. Bartolo, A. Moore, S. Riedel, and P. Steentorp (2022)Fantiastically ordered prompts and where to find them: overcoming few-shot prompt order sensitivity. In Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), Dublin, Ireland, pp. 8086-8098. External Links: Link Cited by: SS1.
* S. Mishra, D. Khashabi, C. Baral, and H. Hajishirzi (2021)Cross-task generalization via natural language crowdsourcing instructions. arXiv preprint arXiv:2104.08773. Cited by: SS1.
* L. Ouyang, J. Wu, X. Jiang, D. Almeida, C. Wainwright, P. Mishkin, C. Zhang, S. Agarwal, K. Slama, A. Ray, et al. (2022)Training language models to follow instructions with human feedback. Advances in Neural Information Processing Systems35, pp. 27730-27744. Cited by: SS1.
* B. Pang and L. Lee (2004)A sentimental education: sentiment analysis using subjectivity summarization based on minimum cuts. In Proceedings of the 42nd Annual Meeting of the Association for Computational Linguistics (ACL-04), pp. 271-278. Cited by: SS1.
* B. Pang and L. Lee (2005)Seeing stars: exploiting class relationships for sentiment categorization with respect to rating scales. In Proceedings of the 43rd Annual Meeting of the Association for Computational Linguistics (ACL'05), pp. 115-124. Cited by: SS1.
* M. Peters, M. Neumann, M. Iyyer, M. Gardner, C. Clark, K. Lee, and L. Zettlemoyer (2018)Deep contextualized word representations. In Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long Papers), pp. 2227-2237. Cited by: SS1.
* F. Petroni, P. Lewis, A. Piktus, T. Rocktaschel, Y. Wu, A. H. Miller, and S. Riedel (2020)How context affects language models' factual predictions. In Automated Knowledge Base Construction

Fabio Petroni, Tim Rocktaschel, Sebastian Riedel, Patrick Lewis, Anton Bakhtin, Yuxiang Wu, and Alexander Miller. 2019. Language models as knowledge bases? In _Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP)_, pages 2463-2473, Hong Kong, China. Association for Computational Linguistics.
* Prasad et al. [2023] Archiki Prasad, Peter Hase, Xiang Zhou, and Mohit Bansal. 2023. GrIPS: Gradient-free, edit-based instruction search for prompting large language models. In _Proceedings of the 17th Conference of the European Chapter of the Association for Computational Linguistics_, pages 3845-3864, Dubrovnik, Croatia. Association for Computational Linguistics.
* Qin and Eisner [2021] Guanghui Qin and Jason Eisner. 2021. Learning how to ask: Querying lms with mixtures of soft prompts. _arXiv preprint arXiv:2104.06599_.
* Radford et al. [2019] Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. 2019. Language models are unsupervised multitask learners. In _OpenAI Blog_.
* Shi et al. [2022] Weijia Shi, Xiaochuang Han, Hila Gonen, Ari Holtzman, Yulia Tsvetkov, and Luke Zettlemoyer. 2022. Toward human readable prompt tuning: Kubrick's The Shining is a good movie, and a good prompt too? _arXiv preprint arXiv:2212.10539_.
* Shin et al. [2020] Taylor Shin, Yasaman Razeghi, Robert L Logan IV, Eric Wallace, and Sameer Singh. 2020. Autoprompt: Eliciting knowledge from language models with automatically generated prompts. _arXiv preprint arXiv:2010.15980_.
* Socher et al. [2013] Richard Socher, Alex Perelygin, Jean Wu, Jason Chuang, Christopher D. Manning, Andrew Y. Ng, and Christopher Potts. 2013. Recursive deep models for semantic compositionality over a sentiment treebank. In _Proceedings of the 2013 conference on empirical methods in natural language processing_, pages 1631-1642.
* Taori et al. [2023] Rohan Taori, Ishaan Gulrajani, Tianyi Zhang, Yann Dubois, Xuechen Li, Carlos Guestrin, Percy Liang, and Tatsunori B. Hashimoto. 2023. Stanford alpaca: An instruction-following llama model. [https://github.com/tatsu-lab/stanford_alpaca](https://github.com/tatsu-lab/stanford_alpaca).
* Touvron et al. [2023a] Hugo Touvron, Thibaut Lavril, Gautier Izcard, Xavier Martinet, Marie-Anne Lachaux, Timothee Lacroix, Baptiste Roziere, Naman Goyal, Eric Hambro, Faisal Azhar, et al. 2023a. Llama: Open and efficient foundation language models. _arXiv preprint arXiv:2302.13971_.
* Touvron et al. [2023b] Hugo Touvron, Louis Martin, Kevin Stone, Peter Albert, Amjad Almahairi, Yasmine Babaei, Nikolay Bashlykov, Soumya Batra, Prajwal Bhargava, Shruti Bhosale, et al. 2023b. Llama 2: Open foundation and fine-tuned chat models. _arXiv preprint arXiv:2307.09288_.
* Voorhees and Tice [2000] Ellen M Voorhees and Dawn M Tice. 2000. Building a question answering test collection. In _Proceedings of the 23rd annual international ACM SIGIR conference on Research and development in information retrieval_, pages 200-207.
* Wei et al. [2022] Jason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma, Fei Xia, Ed Chi, Quoc V. Le, Denny Zhou, et al. 2022. Chain-of-thought prompting elicits reasoning in large language models. _Advances in Neural Information Processing Systems_, 35:24824-24837.
* Wiebe et al. [2005] Janyce Wiebe, Theresa Wilson, and Claire Cardie. 2005. Annotating expressions of opinions and emotions in language. _Language resources and evaluation_, 39(2):165-210.
* Xu et al. [2022] Hanwei Xu, Yujun Chen, Yukun Du, Nan Shao, Wang Yanggang, Haiyu Li, and Zhilian Yang. 2022. GPS: Genetic prompt search for efficient few-shot learning. In _Proceedings of the 2022 Conference on Empirical Methods in Natural Language Processing_, pages 8162-8171, Abu Dhabi, United Arab Emirates. Association for Computational Linguistics.
* Yang et al. [2023] Chengrun Yang, Xuezhi Wang, Yifeng Lu, Hanxiao Liu, Quoc V. Le, Denny Zhou, and Xinyun Chen. 2023. Large language models as optimizers. _arXiv preprint arXiv:2309.03409_.
* Zhang et al. [2023] Wenxuan Zhang, Yue Deng, Bing Liu, Sinno Jialin Pan, and Lidong Bing. 2023. Sentiment analysis in the era of large language models: A reality check. _arXiv preprint arXiv:2305.15005_.
* Zhang et al. [2015] Xiang Zhang, Junbo Zhao, and Yann Lecun. 2015. Character-level convolutional networks for text classification. _Advances in Neural Information Processing Systems_, 2015:649-657.
* Zhao et al. [2021] Tony Z. Zhao, Eric Wallace, Shi Feng, Dan Klein, and Sameer Singh. 2021. Calibrate before use: Improving few-shot performance of language models. _arXiv preprint arXiv:2102.09690_.
* Zhou et al. [2022] Yongchao Zhou, Andrei Ioan Muresanu, Ziwen Han, Keiran Paster, Silviu Pitis, Harris Chan, and Jimmy Ba. 2022. Large language models are human-level prompt engineers. _arXiv preprint arXiv:2211.01910_.