SlowGuess/NeurIPS_2023_OCR huggingface dataset:
Ordering examples inside the summarization prompt Unlike gradient descent, prompting is not robust to the presentation of the examples to the learning algorithm. While we show via ablation studies in Section 5 that there is no statistically significant difference in performance between either shuffling the examples or listing them by class, we can generally expect that depending on the dataset and the number of target classes, one might be preferred over the other.
For instance, in a multi-class setting, listing examples by class might be more helpful in reaching a weak learner quickly. However, in a two-class setting, the summary might actually benefit from randomness in the shuffled examples.
Customizing the summarization prompt The way of asking the LLM to summarize examples can also give rise to good/bad summaries. For instance, one can prompt the LLM with a simple t1;dr or specify the task more elaborately. We will refer to the latter option as explicit. As we demonstrated in Figure 4 (left), both are means to the goal and do not statistically differ in terms of performance induced.
However, in our experiments on certain datasets, we would rather be incentivized choosing the explicit over the t1;dr to attain a weak learner more quickly. This choice becomes important purely for compute reasons as it will take relatively lesser resampling, while the t1;dr still works. For instance, this scenario can happen when the LLM cannot decipher what the summary is supposed to say, by just observing the examples. As examples, the t1;dr prompt suffices on datasets such as iris, diabetes, and wine that are commonly encountered in prediction context, whereas the LLM might not be very familiar with the goals of vertebra-column or somerville-happiness-survey data, necessitating the use of the explicit prompt. For these other datasets, the fact that it is a classification problem based on some features and target classes may not be very apparent from just the examples and metadata. So, providing a directive such as "Summarize in detail how we can tell apart people with normal and abnormal vertebra-column" reduces ambiguity in the task setup and reduces probability of a noisy summary.
While manual intervention is necessary, framing this prompt can be done with little effort. We provide a comprehensive list of these parameters for all datasets in Table 3.
Including Metadata Similar to data conversion, including meta-data information in the prompt offers better penetration into the world of the dataset, as a result improves boosting performance.
Figure 5: Steps of Zeroshot prompting
A.3 Inference
Mapping labels from LLM responses Answer mapping refers to the process of assigning the model's answer to a target output class. This step might be trivial when the answer is the class itself, for example when the LLM responds with "non-relapse" or "recurrence" to a query on the breast-cancer dataset. However, in other instances, it can become tricky when the LLM's responses are "will not recur" or "has higher chance of non-relapse than recurrence", requiring a more complex decoding logic to identify the target class.
Previous works have handled this problem by disguising the task as a Cloze prompt and learning a verbalizer, i.e. MLP projection of hidden state of the [MASK] token, that maps the predicted token to the target classes [Cui et al., 2022, Hu et al., 2021]. By training a verbalizer, one can deterministically go from token vocabulary to the label space. There also exist unsupervised statistical techniques for achieving label mapping [Wang et al., 2022a].
In our method however, we strictly interact with the LLM through prompts and do not access the hidden state nor gradients. As a result, our inference process shown in Figure 2 focuseses on inferring the class label solely through prefix prompts, without relying on learning an explicit mapping. Specifically, by conditioning on a suitable prefix, we constrain the LLM to return exactly the class label string. For example, the prefix "Therefore this iris flower is likely to be (setosa, versicolor, virginica)" works for the iris dataset. A key observation guiding the design of such a prefix prompt is the fact that specifying the output classes entics the LLM to predict from among these classes. With a rather plain prefix like "Predict what will be the type of this flower," the LLM's answer space is unconstrained and it might liberally go on to explain a chain of reasoning such as "The flower has short petals and long sepals, hence it is versicolor, and not setosa." preventing a simple keyword search for the class label.
For a full list of these inference prompts, refer Table 3.
Two-step prompting, Davinci vs. Curie It is worth mentioning that a two-step prompting trick, by first calling "Lets think step by step" then concatenating the response with the prefix prompt also results in accurate answers, as we have shown in Figure 4 (left). However, it could only be implemented on the larger model Davinci but not Curie which is primarily used in our experiments. Interestingly Davinci's chain of thought reasoning even outperforms its prefix prompt counterpart. In all our experiments with Curie however, the prefix technique works reasonably well.
The Davinci API also offers a suffix argument which can be invoked for predicting in a more natural way. For instance, for the breast-cancer dataset, the prompt can be posed with prefix "All in all, this woman is more likely to have a" and a suffix "of breast cancer." directly expecting the LLM to fill in with "recurrence" or "non-relapse."
A.4 Zeroshot Setting
We extend the analysis of prompting-based methods in Section 4.1 by further delving into the Zereshot experiment. We illustrate this experimental setting in Figure 5. It only consists of the inference prompt, wherein the LLM is presented with the metadata and a query. To facilitate answer mapping, the output classes are also indicated in the prompt. Unlike Summary, the zereshot process
Figure 6: Workflow in fewshot prompting
is not stochastic as there is no learning involved. For inference, the predicted tokens are sampled greedily at temperature  $= 0$ .
A.5 Few-shot Setting
Extending the analysis from Section 4, we explain the Fewshot setting. As illustrated in Figure 6, it is an instance of in-context learning, where the support set examples are listed inside the prompt attached with a query in the end. The support set was chosen from the training set through the stratified cluster sampling outlined in Algorithm 1. This results in a semantically diverse collection of examples evenly spread across the classes. Since we observe in Figure 4 (right bottom) that the Fewshot performance drops with more examples, we choose approximately 15 examples to fit in the prompt.
Similar to the Summary method, this inference prompt carries meta-information about the dataset, and also indicates the output classes. The prompt also injects support set examples that are stringed together as we show in Figure 6. The predictions are made greedily at a temperature of 0.
Again, the Fewshot method is a stochastic process whose outcome depends on the selection of the support set. So finding the ideal prompt, requires sampling different support sets from the training set quite a few times. We perform this resampling approximately 25 times and pick the best prompt based on the validation error.
A.6 Preprocessing continuous attributes
Extending from the ablation studies in Section 5, we demonstrate in Table 4, concrete examples of these encoding techniques applied to continuous features. Every numerical column in the dataset was subject to the transformation independently of the rest.
We applied several encoding techniques for continuous features, including binning, percentiles, and standard deviations. Our approach involved using technical language terms to describe these ranges, such as "falls in the nth bin/nth percentile or n deviations above/below mean". We also characterize them in a more naturalistic way by assigning quantifiers such as low, medium, and high to each level in the binning technique.
To create effective textual descriptions, we examined three high-level approaches: 1. presenting only numerical values, 2. using solely textual encodings, and 3. concatenating both. We observed that utilizing textual encoding alone outperformed the other methods. As a result, we focused on mainly comparing textual encoding methods as shown in Figure 4 (right top). Through Bayesian optimization, we found that binning with "5" quantifiers was ideal for generating high-quality summaries.
We describe each encoding technique as follows:
- Binning: It involves creating a histogram with the given number of bins. As outputs, the values are directly described as "falling in the  $n$ -th bin" as illustrated in the 10 bins experiment. However, in the presence of degree quantifiers which are categorical names
assigned to the bins, these tags are used instead. We found that as opposed to calling out the bin number, describing in terms of these quantifiers further aids the LLM in comparing the relative extent to which features match and improving the estimation of similarities. This led us to tune the number of bins against these degree quantifiers, selecting values in the range of 4, 5, 7, and 9 bins. The first four rows in Table 4 show how these tags get translated into the record.
- Percentile: It is given by computing the percentile rank of a value relative to that series of values. Then, the value is described as falling in that percentile rank in words. This is closer to representation of the true numerical values per se, but helps the LLM draw comparisons on a scale of 1-100.
- Standard deviations: In this procedure, the values are segmented into six ranges based on distance from the mean, given by one/two/three standard deviations above/below the mean.
- Quartiles: Here, we consider the first and third quartiles, and the median as landmarks to bucketize the values into four partitions.
Among these methods, the "5 bins with quantifiers" strikes a balance in granularity scale. It is not excessively fine-grained as "percentile", nor overly abstract, as the "4-bin" approach. This balance ultimately leads to optimal performance.
A.7 Cluster Sampling components
We discuss more of the functions in Algorithm 1.
GPT-Embedding is OpenAI's text similarity model text-embedding-ada-002 that takes a maximum input size of 8191 tokens. It returns a 1536-dimensional embedding for text. OpenAI recommends cosine distance for comparing ada embeddings in downstream tasks.
As a result, the AgglomerativeClustering algorithm applies hierarchical clustering over these features using cosine distance, average linkage and a heuristically selected distance threshold of 0.05. It yields a set of clusters  $C$  and each  $C_j$  contains a list of indices of data points that belong to that cluster  $j$ .
A.8 Adaboost Optimizations
We additionally apply several run-time optimizations to the boosting algorithm described in 3.3. Thus we present its full version in Algorithm 3.
- Raising the bar for a weak learner: Our goal was to create high-quality summaries that dramatically reduce the validation error rate and significantly accelerate the convergence of the boosting procedure. Thus we raise the performance threshold to a notch slightly higher than random guessing probability (see Step 15 in Algorithm 3), provoking insightful summaries.
We resample until finding a weak learner that satisfies this threshold.
The positive quantity  $\mu$  is a hyperparameter that typically takes values 0.08 for 2-class problem and 0.16 for 3-class problem, and so on.
Although this step increases compute, it yields better weak learners and improves convergence overall.
- Permuting the predicted class label assignments:
We harness the potential of permuting the class assignments by exploring  $K!$  different mappings of predictions to classes using the PermutedLabelMappings function in steps 11-14. This process helps us identify the mapping that minimizes the training error to the greatest extent.
By considering multiple permutations of predictions across the label space, as outlined in Steps 11-14 of Algorithm 3, we obtain a hashmap  $p$  from the PermutedLabelMappings function. This hashmap maps the predictions  $\hat{y}$  to the permuted label space. Selecting the mapping,  $p^*$  that results in the lowest training error effectively diminishes the cumulative training error during boosting iterations and proves to be an effective strategy for generating strong weak learners. This technique is particularly advantageous in scenarios involving more than two classes.
Algorithm 3 Summary Boosting
1: Input:  $X$ , all training data;  $y$ , all training label; T: maximum number of rounds; s: size of the sampled subset.  
2: h, P,  $\epsilon$ ,  $\alpha$  ← empty array of size T. ▷ h holds the round-wise hypotheses, P are the corresponding label mappings,  $\epsilon$  gathers the weighted train errors, and  $\alpha$  are coefficients of the hypotheses.  
3: N ← len(X)  
4: c ← set of target classes  
5: K ← len(c)  
6: w ← new array of size N filled with 1/N. ▷ w is the weighted data distribution  
7: for r = 1 to T do  
8:  $(X_s, y_s) \gets$  Cluster-sample s examples from training distribution w.  
9: h[r] ← Summary  $(X_s, y_s)$  ▷ h[r] is the weak learner in the current round  
10:  $\hat{y}[i] \gets h[r](X[i])$  ▷  $\hat{y}$  refers to predictions on training set  
11:  $\xi \gets$  empty hashmap ▷  $\xi[p]$  will have error rate of the corresponding label mapping p  
12: for p in PermutedLabelMappings(c) do  
13:  $\xi[p] \gets \frac{\sum_{i=1}^{N} w[i] \times 1 \{p[\hat{y}[i]] \neq y[i]\}}{\sum_{i=1}^{N} w[i]}$   
14: end for  
15:  $p^* \gets$  arg min $_p$ $\xi[p]$   
16: if  $\xi[p^*] > 1 - \frac{1}{K} - \mu$  OR AllSame( $\hat{y}$ ) then Goto Step 8.  
17: else  
18: P[r] ←  $p^*$ ;  $\epsilon[r] \gets \xi[p^*]$   
19: end if  
20: if  $\epsilon[r] == 0$  then  
21: Break  
22: end if  
23:  $\alpha[r] \gets \log\left(\frac{1 - \epsilon[r]}{\epsilon[r]}\right) + \log(K - 1)$   
24: for i = 1 to N do  
25: w[i] = w[i] × exp( $\alpha[r] \mathbb{1}\{P[r][h[r](X[i])] \neq y[i]\}$ )  
26: end for  
27: w ←Normalize(w)  
28: end for  
29: Return h,  $\alpha$
- Sanity checks: Finally, to ensure robustness of the weak learner when faced with skewed datasets, we have implemented a policy that disallows a naive all-ones classifier. The condition calling AllSame in Step 15 of Algorithm 3 performs this check.
A.9 Text Templates
In the ablation study which involves comparing the descriptions created manually vs. by a LLM, as illustrated in Figure 3 (right), we transform the descriptive attributes into the textual format by applying a pre-defined template. In Table 5 we provide examples of these templates for selected datasets.
A.10 Complexity Analysis
We provide the time complexity analysis comparing our boosting procedure to finetuning the LLM.
For finetuning, the complexity is  $\mathcal{O}(TNf)$ , where  $f$  is runtime of the LLM,  $T$  is number of epochs,  $N$  is the number of data points.
For summary boosting, the complexity is  $\mathcal{O}(TRf)$ , where  $f$  is runtime of the LLM,  $T$  is number of boosting rounds and  $R$  is the number of resampling per round.
Concretely, for a dataset with 175 examples, finetuning takes 20 epochs  $\times$  175 examples  $\times$  2 = 7000 passes through the LLM. 2 stands for both forward and backward passes through the model.
For the same dataset boosting requires 50 rounds  $\times 25$  resampling on average  $= 1250$  passes through the LLM.
Thus, we believe the complexity of our algorithm is at least comparable to, if not better than, that of finetuning (without considering the cost of the actual API calls).
A.11 Estimating the cost of API calls
While our method is applicable to any large language model, we primarily conducted experiments using GPT-3. Each API call to GPT-3 incurs a specific dollar cost.
After analyzing the running time complexity of summary boosting, which is  $\mathcal{O}(TRf)$ , we can provide a rough estimation of the cost associated with training a classifier on any given dataset.
To begin, when making a call to summarize examples, the prompt is filled up to the maximum context length, which is 2048 tokens for the query prompt and completion. We'll refer to these summary tokens as  $S_{t} = 2048$ .
Additionally, if  $N$  represents the size of the dataset and we allocate  $(50 + 10)$
Now, to obtain a weak learner at boosting round  $r$ , we may need to resample up to  $R$  candidate summaries. Furthermore, we calculate the training error for each candidate summary to determine if it performs better than random guessing. Once the desired weak learner is found, we compute the validation error for that round only once. Therefore, each round requires querying  $R \times (S_t + 0.5N \times P_t) + 0.1N \times P_t$  tokens.
Considering that the maximum number of rounds is denoted as  $T$ , the total number of tokens exchanged would be  $T \times [R \times (S_t + 0.5N \times P_t) + 0.1N \times P_t]$ .
For instance, let's consider a dataset with 175 examples. In this case, the cost would be 30 rounds × [20 resampling × (2048 summary tokens + (0.5 × 175 training examples) × 210 prediction tokens) + (0.1 × 175 validation examples) × 210 prediction tokens] = 12364050 tokens, which approximately costs $25 for Curie at a rate of $0.002/1K tokens.
A.12 Can ChatGPT function as a weak learner?
One would expect that it is more advantageous to try newer LLMs such as ChatGPT that produce increasingly more human-like text and are far more sample-efficient, i.e. can summarize more examples since they come with a larger context length. To investigate this, we conduct experiments by feeding ChatGPT with the same tabular data descriptions and using identical prompts to create weak learners. The results are presented in Table 6.
Surprisingly ChatGPT outperforms Curie in classifying datasets with more numerical features, such as wine, wholesale-customers, and iris. This observation suggests that LLMs are becoming more adept at quantitative reasoning from finetuning with more data. However, the reinforcement learning from human feedback (RLHF) [Ouyang et al., 2022] poses a limitation as it still ensures the generated text does not deviate too much from its prior. The generated text distribution adheres closely to the behavior programmed into the LLM induced by optimizing with such a reward model. Consequently it becomes challenging to bias the LLM with adversarial examples that might occasionally emerge in the training set.
For example, ChatGPT does not mostly generalize well on datasets with medical information such as vertebra-column, breast-cancer, caesarian and blood-transfusion-center where there can be examples contrary to common medical beliefs. In these cases, the RLHF is more restrictive due to its conformity to human preferences and does not neutrally summarize examples at hand from a classification standpoint. However, boosting imposes a significantly higher penalty on examples that the model fails to classify correctly, causing ChatGPT to not decrease training error after a few epochs. While these models exhibit promise in terms of higher-order problem-solving skills, their capabilities can also be limited by their alignment with human preferences.
A.13 Others LLM providers: Claude-2
Summarizing documents and text-based reasoning are standard use cases of LLM, so in principle we expect Summary Boosting to work with other prompt-based LLMs. To validate this claim, we tested our method on other LLMs different from GPT, specifically Claude-2. The results for four datasets are given in Table 7. We see that the performance of Claude-2 is slightly worse than that of GPT-3 Curie (but better than ChatGPT). This experiment demonstrates that our method still works outside GPT-3, and is able to produce weak learners for different base LLMs. Though the scope of the experiments is limited, it shows preliminary evidence that the method is robust across models. On the other hand, Claude-2 released by Anthropic is accessed through a commercial API. In section A.14 we discuss the limitations of using commercial APIs for summary boosting.
A.14 Implications of using commercial API for LLM experiments
Our experiments are done using OpenAI's API access. We chose to use APIs instead of hosting the LLMs because it lets us test the capabilities of the models at a reasonable efficiency as boosting requires many sequential calls to the language model and we need to do it on many datasets in parallel. At the current pace of innovation in LLMs, we are cautiously optimistic that there will be software solutions (e.g., for efficient inference) that will change the circumstances. In this section, we discuss the limitations and effects of using LLMs for ML research in general.
- Limited Customization: Commercial APIs may not allow fine-tuning the model according to our specific needs. We might not have control over the architecture, hyperparameters, or training data used for the model, which can be crucial for certain research tasks. The backend models offered by these vendors are also continuously updated either through new training methods or more data. For ML research in general, it will be a good practice to mention the version of the model for replicating the experiments.
- Lack of Transparency: The inner workings and architecture details of commercial APIs are often proprietary and not fully disclosed. This lack of transparency can make it challenging to understand model behavior, biases, and limitations. Specifically, it deprives us of the opportunity to study the training process itself, which can be valuable for understanding how these models learn and for improving our own research methodologies. Commercial APIs may inherit biases present in the training data, potentially leading to biased or unfair responses.
- Data Privacy and Security: Using a commercial API involves sending the data to an external server, which might raise concerns about data privacy and security, especially if we are dealing with sensitive or confidential information. There might also be regulatory and legal considerations when passing sensitive data to these API.
Table 6: Comparing test error rate of Summary Boosting backend by Curie and ChatGPT on all datasets (↓). Refer to caption of Table 1 for the notations used.
Dataset	Data Type	Size	Curie	ChatGPT
caesarian [cae] (42901)	1c4d	80	0.300±0.04	0.406±0.03
iris (61)	4c0d	150	0.193±0.03	0.083±0.01
tae (48)	1c4d	151	0.454±0.03	0.443±0.04
glass (41)	9c0d	214	0.370±0.02	0.492±0.02
breast-cancer [bc] (13)	7c5d	277	0.288±0.02	0.360±0.01
visualizing-environmental [ve] (678)	3c0d	111	0.268±0.03	0.333±0.04
ancaldata-chlamydia [ac] (535)	2c2d	100	0.170±0.01	0.300±0.06
wine (43571)	13c0d	178	0.320±0.01	0.250±0.01
blood-transfusion-center [btc] (1464)	4c0d	748	0.240±0.04	0.433±0.01
somerville-happiness-survey [shs] [Koczkodaj, 2018]	0c7d	143	0.350±0.02	0.430±0.02
vehicle (54)	18c0d	846	0.410±0.04	0.350±0.16
statlog-heart [stath] [Dua and Graff, 2017]	6c7d	270	0.430±0.01	0.370±0.17
verterbra-column [vc] (1524)	6c0d	310	0.262±0.01	0.669±0.03
ecoli (1011)	7c0d	336	0.270±0.03	0.193±0.03
haberman-survival [hs] (43)	3c0d	306	0.250±0.01	0.415±0.03
diabetes [dia] (37)	8c0d	768	0.344±0.01	0.297±0.04
visualizing-hamster [hams] (708)	5c0d	73	0.207±0.00	0.400±0.08
wholesale-customers [wc] (1511)	6c1d	440	0.330±0.00	0.199±0.04
Table 7: Test error rate of Summary Boosting applied to Claude-2 vs. Curie (↓). The experiments with Claude-2 were run using the same prompts as Curie from table 3.
Dataset	Data Type	Size	Claude-2	Curie
caesarian [cae] (42901)	1c4d	80	0.312±0.03	0.300±0.04
iris (61)	4c0d	150	0.200±0.02	0.193±0.03
breast-cancer [bc] (13)	7c5d	277	0.385±0.05	0.288±0.02
vertebra-column [vc] (1524)	6c0d	310	0.310±0.03	0.262±0.01