date: 2024-07-03
title: "Chain-of-Thought Reasoning Without Prompting"
status: DONE
author:
- AllenYGY
tags:
- CoT
- ReadPaper
- DeepLearning
- CoT-Decoding
publish: True
Chain-of-Thought Reasoning Without Prompting
这篇文章通过优化解码方法,提出了CoT-Decoding, 提高回答的准确性
CoT-Decoding 类似做选择题时的排除法
传统的解码方法是 Greedy decoding
贪婪解码(Greedy Decoding)是一种简单的序列生成方法,通常用于自然语言处理中的文本生成任务。在这种方法中,每一步都选择具有最高概率的下一个词作为输出,直到生成结束符或达到预定的输出长度。
具体过程如下:
贪婪解码的优点是实现简单,速度快,因为它只需在每一步选择一个最高概率的词。然而,这种方法有一个明显的缺点,即它可能会错过全局最优的序列。由于每一步都只选择局部最优的词,贪婪解码可能会导致生成的文本质量较低,缺乏连贯性和多样性。
例如,在给定一个语言模型预测下一个词的任务中,如果模型在某一步预测的概率分布为:
贪婪解码会选择概率最高的词 "The" 作为输出,然后继续这个过程,选择下一个词,直到生成完整的句子。
The formula represents the confidence score
Where:
Here,
The model’s overall confidence in decoding the final answer is approximated by averaging these probability differences for all relevant answer tokens
这个公式表示对答案
其中:
这个公式表示将所有解码路径中对答案
This formula represents the calculation method for the overall confidence degree
Where:
This formula indicates that the overall confidence degree of answer
CoT-Decoding Effectively Elicits Reasoning from Language Models
CoT-Decoding Enables a Better Understanding of Model's Intrinsic Reasoning Abilities
Combining CoT-decoding with CoT-Prompting
这个实验采用了不同的采样和解码方法对Mistral-7B这个预训练模型进行测试
采样方法包括
解码方法包括
作者认为只有 CoT-decoding 方法可以有效地引导模型进行推理。
在这个实验中,作者针对不同的模型包括 Mistral-7B、PaLM-2 和 Gemma,分别采用Greedy Decoding 和 Cot Decoding 进行测试。
针对不同的模型,采用 CoT-Decoding 方法,都能提高模型的准确性
在这个实验中,作者对GSM8K和Year Parity两个测试集
使用不同参数的同一个模型PaLM-2进行测试
CoT-decoding reliably improves reasoning performance across model scales (PaLM-2), even when the task does not naturally improve by scaling up only (e.g., year parity).
在下图的 Large size 和 Instruction-tuned 的两个模型测试结果上看,两者的准确率相差不大
更有趣的是,CoT-Decoding 可以优化 Instruction-tuned model
因为 CoT-Decoding 最后还是得从模型中给出的 K 条路径里选择一条推理路径
所以 K 的选择会影响最终的结果
在这个实验里,作者对PaLM-2 model 进行不同 K 值的测试
Overall we found that higher values of K typically result in improved model performance, suggesting that in many cases, the correct CoT paths may indeed exist but are often ranked lower during model's decoding.
For instruction-tuned models, the effect of 𝑘 is less significant, indicating that the process of instruction-tuning effectively brings forth the majority of CoT-paths to the first few decoding paths.
总体上看,较高的 K 值通常会导致模型性能的提高,这表明在许多情况下,正确的 CoT 路径可能确实存在,但通常在模型的贪心解码过程中排名较低。
对于指令微调的模型,K的影响较小,这表明指令调整的过程有效地将大多数 CoT 路径提到了前几个解码路径中。
作者认为 CoT-Decoding 能更好地揭露模型的内在推理能力
在这个实验里使用 CoT-Decoding,尝试了常见的几个推理任务
Coin Flip Task(抛硬币任务):
Web of Lies Task(谎言之网任务):
Multi-step Arithmetic Task(多步骤算术任务):
当解决方案涉及最多1或2步知识操作时,模型可以生成正确的 CoT 路径,但当步骤变为3或更多时,模型开始难以生成正确的 CoT 路径。作者认为这表明模型在推理方面的局限性。
作者也认为这与 (McCoy et al., 2023) 的研究结果一致,他们表明语言模型受到它们训练的分布的影响。
在 Coin-Flip 和 Web-of-Lies 任务中,我们观察到模型可以生成逐步模拟过程的 CoT 路径,但当任务复杂度增加时,模型很容易失去状态。
在 Multi-step Arithmetic 任务中,我们观察到模型倾向于在 CoT-decoding 路径中从左到右进行计算,而不是按照正确的数学顺序进行计算。
总的来说,就是 CoT-Decoding 可以从模型里选到比较合理的推理路径,但没办法无中生有直接生成正确的推理路径
最后作者尝试把CoT-Decoding 和 CoT-Prompting 结合,发现效果会更好
CoT-Decoding maintains a strong performance compared to self-consistency (Wang et al., 2023a) when both are combined with CoT-prompts.
CoTCoT-Decoding 与 CoT-Prompting 结合后,与 self-consistency 方法相比,性能仍然很强。
Since self-consistency aggregates over multiple paths, we also show the performance based on our path aggregation algorithm, which significantly improves the model's reasoning at a similar cost.
由于 self-consistency 聚合了多个路径,我们还展示了基于我们的路径聚合算法的性能,在成本差不多的情况下,模型的推理能力显著提高。