Today I Learned
Day 31 - Prompting Techniques - Self-consistency
As we learned in the previous Chain of Thought prompting section, the model can be prompted to generate reasoning steps like a human solving a problem. However CoT uses a simple ‘greedy decoding’ strategy, limiting its effectiveness. Self-consistency combines sampling and majority voting to generate diverse reasoning paths and select the most consistent answer. It improves the accuracy and coherence of responses generated by LLMs.
Self-consistency gives a pseudo-probability likelihood of an answer being correct, but obviously has high costs.
It follows the following steps:
- Generating diverse reasoning paths: The LLM is provided with the same prompt multiple times. A high temperature setting encourages the model to generate different reasoning paths and perspectives on the problem.
- Extract the answer from each generated response.
- Choose the most common answer.