Self Consistency

Self Consistency

The slf consistency techniques is discussed in details in the research paper titled:

SELF-CONSISTENCY IMPROVES CHAIN OF THOUGHT REASONING IN LANGUAGE MODELS

Link to paper

NOTE: Authors have observed 18% improvement, which means that only 1 out 5 prompts will see an improvement in results.

Few Shot CoT + Self Consistency

The prompts below are a plain few-shot prompt taken from the GSMK8 dataset. Try out prompts for models of your choice to understand the behavior. Keep in mind that authors of the paper have indicated an average of 17.9% improvement for GSMK8 tasks, as a result you may or may not see the desired results.

Following examples were tested with AI 21 Jurassic Mid-2 but you may use playground for any other models. Keep in mind that the results will vary, depending on the model.

Tests were successful with AI 21 Jurassic Mid-2.

Model: AI 21 Jurrasic-Mid (j2-mid)

Temperature 0.7

Top-P 0.4

  • Copy - Paste the prompt
  • Chances are high you would get an incorrect answer
  • Copy - Paste the fix on top of the prompt & try again

Note If you don’t get the desired results, you can try the following:

  • Change the temperature and/or top-p
  • Switch to a different AI 21 model e.g., j2-ultra
  • Change the number of experts e.g., from 3 to 5
  • Adjust the language in the self-consistency instructions
  • Try with model from a different provide e.g., Google Flan T5 XXL

Example-1



Question:Jasper will serve charcuterie at his dinner party. He buys 2 pounds of cheddar cheese for $10, a pound of cream cheese that cost half the price of the cheddar cheese, and a pack of cold cuts that cost twice the price of the cheddar cheese. How much does he spend on the ingredients?
Answer:A pound of cream cheese cost $10 / 2 = $<<10/2=5>>5.
A pack of cold cuts cost $10 x 2 = $<<10*2=20>>20.
Jasper spent $10 + $5 + $20 = $<<10+5+20=35>>35 on the ingredients.
#### 35

Question:Joy can read 8 pages of a book in 20 minutes. How many hours will it take her to read 120 pages?
Answer:In one hour, there are 3 sets of 20 minutes.
So, Joy can read 8 x 3 = <<8*3=24>>24 pages in an hour.
It will take her 120/24 = <<120/24=5>>5 hours to read 120 pages.
#### 5

Question:Cappuccinos cost $2, iced teas cost $3, cafe lattes cost $1.5 and espressos cost $1 each. Sandy orders some drinks for herself and some friends. She orders three cappuccinos, two iced teas, two cafe lattes, and two espressos. How much change does she receive back for a twenty-dollar bill?
Answer:

Answer : Find the total cost of the cappuccinos by multiplying the price by the quantity: 3 cappuccinos x $2/cappuccino = $«32=6»6 Then do the same for the iced teas: 2 iced teas x $3/tea = $«23=6»6 Then do the same for the cafe lattes: 2 lattes x $1.5/latte = $«21.5=3»3 Then do the same for the espressos: 2 espressos x $1 = $«21=2»2 In total Sandy pays $6 + $6 + $3 + $2 = $«6+6+3+2=17»17 Sandy will receive $20 - $17 = $«20-17=3»3 in change #### 3

Fix : Self Consistency

Add the prompt text below to the top of the few shot prompt from above and try again. You may get the correct answer.

Imagine 3 completely independent experts who reason differently 
are answering a question. The question is prefixed with 'Question:' and answer is delimited by 4 hashtags
The final answer is obtained by majority vote.

Step 1. For each of the experts, give their step-by-step reasoning and answer
Step 2. Determine the final answer by majority vote
Step 3. Return the final answer, obtained by majority vote, prefixed by 'Final answer:'

Example-2



Question:Paul went to a shop to buy some groceries. He bought some bread for $2, butter for $3, and juice for two times the price of the bread. He had $15 for his shopping. How much money did Paul have left?

Answer:The price of the juice was 2 * 2 = $<<2*2=4>>4.
So in total he paid for his shopping 2 + 3 + 4 = $<<2+3+4=9>>9.
That means he had 15 - 9 = $<<15-9=6>>6 left.
#### 6

Question:Ed has 2 dogs, 3 cats and twice as many fish as cats and dogs combined. How many pets does Ed have in total?
Answer:If Ed has 2 dogs and 3 cats he has in total 2+3 = <<2+3=5>>5 pets that are not fish
If Ed has twice as many cats and dogs combined he has 2*5 = <<2*5=10>>10 fish
Therefore, in total Ed has 5+10 = <<5+10=15>>15 pets
#### 15

Question:Jason is mixing a batch of black paint. He needs to add 2 grams of charcoal for every 30 ml of water. If he adds 900 ml of water, how much charcoal does he add?
Answer:

Answer : First find how many ml of water Jason needs for 1 gram of charcoal: 30 ml / 2 grams = «30/2=15»15 ml/g Then divide the amount of water Jason uses by the amount of water per gram of charcoal to find how much charcoal he uses: 900 ml / 15 ml/g = «900/15=60»60 g #### 60

Fix : Self Consistency

Add the prompt text below to the top of the few shot prompt from above and try again. You may get the correct answer.

Imagine 3 completely independent experts who reason differently 
are answering a question. The question is prefixed with 'Question:' and answer is delimited by 4 hashtags
The final answer is obtained by majority vote.

Step 1. For each of the experts, give their step-by-step reasoning and answer
Step 2. Determine the final answer by majority vote
Step 3. Return the final answer, obtained by majority vote, prefixed by 'Final answer:'