Keep Your Word! Self Consistency Prompting
Self Consistency Prompting
is a technique that involves presenting or pre-generating multiple thought processes, guiding AI to think consistently by referencing these examples.
Large Language Models (LLMs) generate various logical grounds when faced with reasoning problems, making decisions probabilistically.
Self Consistency Prompting minimizes the non-deterministic nature (does not guarantee the same output for identical inputs every time) of LLMs, encouraging consistent reasoning by the AI.
Application Examples of Self Consistency Prompting
When Jake was 6 years old, his sister was
half his age.
Now if Jake is 70 years old, how old is his sister?
She is 35 years old.
In the example above, Jake's sister is three years younger than him, so she should be 67 years old.
However, the prompt does not guide logical reasoning and simply requires a straightforward calculation of the current age, leading to an incorrect answer.
By applying Self Consistency Prompting, you can provide multiple scenarios for solving the mathematical problem, allowing AI to reference these and think consistently.
Question 1:
Emily had 2 apples.
On her birthday, her grandmother and
grandfather each gave her 1 more.
How many apples does Emily have now?
Answer 1:
Emily originally had 2 apples.
She received 1 more from each of her grandparents,
so she has 2 + 1 + 1 = 4 apples.
The answer is 4.
Question 2:
Ryan bought a new pair of sneakers,
making it 3 pairs in total.
He donated one old pair.
How many pairs of sneakers does Ryan have now?
Answer 2:
Ryan had 3 pairs of sneakers in total after
buying the new ones.
He donated one pair,
so he has 3 - 1 = 2 pairs left.
The answer is 2 pairs.
### Question:
When Jake was 6 years old, his sister was half his age.
Now if Jake is 70 years old, how old is his sister?
### Answer: [?]
Answer:
When Jake was 6 years old, his sister
was half his age, 3 years old.
Thus, the age difference between Jake and his sister
is 6 - 3 = 3 years.
If Jake is 70 years old,
his sister is 70 - 3 = 67 years old.
The answer is 67 years.
Connection with Chain of Thought (CoT) Prompting
As seen in the prompt example above, it is similar to Chain of Thought (CoT)
prompting, where the thought process is presented step by step, guiding the AI to perform consistent reasoning by referencing it.
Self-consistency Prompting extends the concept of CoT by generating multiple step-by-step thought flows, selecting the most frequently occurring answer as the final one or allowing AI to reference previous answers to maintain a consistent thought flow.
Practice
Send a prompt example and compare the AI's responses.
Want to learn more?
Join CodeFriends Plus membership or enroll in a course to start your journey.