1 of 19

Chain of Thought integrated active learning lesson plans in secondary Algebra

2 of 19

Lesson 2G Plan in Algebra 

  • What is "Chain of Thought" (CoT) prompt engineering?
  • How does CoT prompt engineering work: first simple example
  • How does CoT prompt engineering work: Algebra example
  • Using CoT to get LLM to get the correct answer

3 of 19

1. What is "Chain of Thought" (CoT) Prompt Engineering?

Chain of Thought (CoT) is a technique we can use to improve the LLMs' performance on certain tasks. 

Instead of asking the LLM a question directly, we break down the problem into smaller parts, and guide the model through solving each part step by step. 

This method can help the model generate more accurate answers, and it allows us to understand the problem-solving process more clearly.

Chain-of-Thought Prompting Elicits Reasoning in Large Language Models https://arxiv.org/pdf/2201.11903.pdf  -  "enables" reasoning capabilities of the LLM through intermediate steps of reasoning

Normal prompt or original question (O-Q) ChatGPT:

Find the solution to.....

Chain of Thought prompt engineering template:

Q: Problem similar to original problem to be solved

A: Full step of solution

QFind the solution to...

4 of 19

2. How does "Chain of Thought" work: 1st simple example

Example 1

Simplify:         

Solution: 

5 of 19

Let's see if ChatGPT gets it correct?

Putting O-G into ChatGPT, get

(4a^2) / (5b)

which is wrong!

https://poe.com/s/UbyBaIaY21VHEmbLMjXB 

6 of 19

Let's see if ChatGPT gets it correct?

Where did it go wrong?

Nonsense!

Putting O-G into ChatGPT, get

(4a^2) / (5b)

which is wrong!

https://poe.com/s/UbyBaIaY21VHEmbLMjXB 

7 of 19

Example:

Consider teaching the LLM how to solve a "similar problem":

i.e., Simplify            3a^3b^4/(27a^6b^2)

Let's produce the model answer:

To simplify the expression ((3a^3b^4)/(27a^6b^2)), you first divide the numerical coefficients and subtract the exponents of like terms. Here's how it works:

    • Divide the numerical coefficients: (3 / 27 = 1/9)
    • Subtract the exponent in the denominator from the exponent in the numerator for the a terms: (3 - 6 = -3) This gives (a^{-3}), which is equivalent to (1/a^3) when moved to the denominator.
    • Do the same for the b terms: (4 - 2 = 2) This gives (b^2) in the numerator.

When you put it all together, the simplified form of the expression is:

[\frac{b^2}{9a^3}]

Use the above example to "train" the LLM on how to solve these problems, step by step

8 of 19

Plug (Q, A, Q) into ChatGPT

https://poe.com/s/WokNr9DrKtmhjnel5ODs   

Got it CORRECT!!!

Because we "trained/taught" the LLM how to solve such problems, step by step.

9 of 19

�3. How does CoT Prompt Engineering work: �Algebra Example

   Example 1:  Solve for u:       (5-u)/(-6) = 2

Answer:   

Given: (5-u)/(-6) = 2

Multiply both sides by -6 (the denominator):

(5-u) = -12

Simplify:

5-u = -12

Add u to both sides:

5 = -12 + u

Add 12 to both sides:

17 = u

Therefore, u=17.

10 of 19

Let's see if Google PaLM gets it correct?

Putting O-G into ChatGPT, get

-7

which is wrong!

  https://poe.com/s/LCDY6Zopx9yHltp9Be1C

https://poe.com/s/OavyPtcsFcZVJy52oF7A

11 of 19

Example:

Consider teaching the LLM how to solve a "similar problem":

i.e., Example 2:

Solve 

Let's produce the model answer:

-2 * (7 + u) / -2 = -2 * 8

7 + u = -16

u=-7-16

u=-23

Use the above example to "train" the LLM on how to solve these problems, step by step

12 of 19

Let's see if Google PaLM gets it correct?

Putting O-G into ChatGPT, get

-7

which is wrong!

  https://poe.com/s/LCDY6Zopx9yHltp9Be1C

https://poe.com/s/OavyPtcsFcZVJy52oF7A

Where did it go wrong?

13 of 19

Plug (Q, A, Q) into Google PaLM: 

https://poe.com/s/6BbF9VhuHuYkH2bMpEwz 

Got it CORRECT!!!

Because we "trained/taught" the LLM how to solve such problems, step by step.

14 of 19

4. Using CoT to get LLM to get the correct answer 

Example 2: 

Solve the following for c:  

7 - (c-2)/4 = 5

Answer:  

7-5= (c-2)/4  ==> 2 = (c-2)/4

==> 8 = c-2  ==>  c=10. 

Therefore,   c=10.

15 of 19

4. Using CoT to get LLM to get the correct answer 

LLM answer WRONG

16 of 19

4. Using CoT to get LLM to get the correct answer 

Example 3:

Solve the equation for y:                 4=-2 + (y+3)/3

  • Please scan the QR code or go to the following URL to write down your answer in text:

2. Plug your answer into your LLM Google PaLM in the form of (Q, A, Q) to see if you got the right answer.  First one who posts on YoTeach! Wins!

17 of 19

4. Using CoT to get LLM to get the correct answer 

Correct (CoT-Q, CoT-A, O-Q)

18 of 19

4. Using CoT to get LLM to get the correct answer

f 

Note: Students can post up a screenshot, or a poe.com sharelink to the ChatGPT prompt and answer, and

It is TIME-STAMPED, so you know who posted first!

19 of 19

Questions?

Please contact either

  • Dr. Carter LAM (lamwh@eduhk.hk)
  • Dr. Fridolin TING (fridolin@eduhk.hk)

for any further questions, comments or feedback.