Paper Review | Auto-CoT — Generating Chain-of-Thought via Clustering

Title: Automatic Chain of Thought Prompting in Large Language Models
Institute: Shanghai Jiao Tong University, Amazon Web Services
Authors: Zhuosheng Zhang, Aston Zhang, Mu Li, Alex Smola
Arxiv Link: https://arxiv.org/abs/2210.03493
Date: 2022.10.7
Introduction
Before this work, chain-of-thought prompting existed in two paradigms. The first is Zero-shot CoT, which simply appends “Let’s think step by step” to the end of the question. The second is Manual CoT (Few-shot CoT), where each exemplar consists of a question paired with a reasoning chain. How well the second approach works depends entirely on how good the hand-written chains are — and writing them takes human effort. The authors propose Auto-CoT, which generates few-shot CoT exemplars automatically and spares us that manual labor.
Motivation
Manual CoT (Few-shot CoT) outperforms Zero-shot CoT but consumes far more human effort, so the authors set out to design Auto-CoT.
Findings
Unlike papers that present their method up front, this one first runs a series of exploratory experiments and only then arrives at its proposal.
The authors begin by comparing Retrieval-Q-CoT against Random-Q-CoT on three datasets: MultiArith, GSM8K, and AQuA. On MultiArith, Retrieval-Q-CoT turns out to be worse than Random-Q-CoT, which is clearly counterintuitive. Suspecting that the culprit was the poor quality of the Zero-shot-generated chains, they repeated the experiment on GSM8K and AQuA, two datasets whose CoT annotations are human-written. As expected, Retrieval-Q-CoT outperformed Random-Q-CoT on both. The conclusion: chains produced by Zero-shot are simply not as good as human-written ones.
Retrieval-Q-CoT: encode the question with Sentence-BERT, then take the top-k most similar questions as demonstrations, $q_i^{demo}(i=1,..,k)$. For these k questions, generate chains with Zero-shot — $c_i^{demo}$ — then concatenate $q_i^{demo},c_i^\text{demo}(i=1,…,k),q^{test}$ as the input to the LLM.
Random-Q-CoT: same as Retrieval-Q-CoT, except the k questions are chosen at random.
To further verify that flawed chains are what degrade reasoning, the authors deliberately injected incorrect chains into 128 out of 600 examples. Retrieval-Q-CoT was indeed misled, confirming how much correct chains matter in CoT prompting.
Going further, the authors clustered all questions into k groups by similarity with k-means, then generated chains with Zero-shot and ran inference. To find out whether certain clusters concentrate the questions on which Zero-Shot-CoT tends to fail, they computed the error rate of each cluster.

As the figure shows, cluster 2 has a strikingly high error rate, which indicates that Zero-shot cannot produce good chains for a certain class of questions — likely the reason Retrieval-Q-CoT underperforms.
Auto-CoT
Building on these findings, the authors propose Auto-CoT, which consists of two main stages:
- Clustering: partition the questions of a given dataset into several clusters.
- Sampling: select one representative question from each cluster and generate its reasoning chain with Zero-Shot-CoT under a simple heuristic.
The overall pipeline is shown below:

In more detail:
- In the clustering stage, all questions are embedded with Sentence-BERT and partitioned into k classes by k-means. Within each cluster, questions are sorted by their distance to the cluster center, producing an ascending list $\mathbf{q}^{(i)}=[q_1^{(i)},q_2^{(i)},\ldots]$.
- In the sampling stage, each cluster is traversed in that ascending order. A chain is generated for the current question with Zero-shot; if the chain runs to no more than 60 tokens and five steps, that question and its chain become the exemplar for every question in the cluster and are prepended to them at inference time.
Experiments
The experiments cover three categories of reasoning tasks across ten benchmark datasets, all with GPT-3:
- Arithmetic reasoning (MultiArith, GSM8K, AddSub, AQUA-RAT, SingleEq, SVAMP)
- Commonsense reasoning (CSQA, StrategyQA)
- Symbolic reasoning (Last Letter Concatenation, Coin Flip)
The baselines are Zero-Shot, Zero-Shot-CoT, Few-Shot, and Manual-CoT.
As the table below shows, Auto-CoT consistently matches or exceeds the performance of CoT methods that require manually designed demonstrations.

Conclusion
Viewed from 2024, the method in this paper looks fairly simple next to work such as ReAct. It is worth remembering, however, that it appeared quite early, when everyone was still feeling their way forward — which makes a method like this all the more valuable. In fact, traces of Auto-CoT are still visible in the latest approaches.