본문 바로가기

LangChain&LangGraph

Plan-and-Solve Prompting 논문 리뷰

# introduction 

- 모델 내부 파라미터에 접근할 수 없는 서비스 형태로 서비스 제공 , 파인튜닝도 어려움

- 대신 instruction이나 trigger sentences 통해 문제 해결 유도, 성능 향상 보인

- 그럼에도 불구하고  7%의 게산 오류 , 12%의 단계 누락, 27% 의미 이해 오류 발생 하는 한계 

- 이러한 문제 해결위해 Plan-and-Solve prompting 제안 ( PS prompting)

 

instruction : " 목적, 방식, 범위 등"

trigger sentence : "Let’s think step by step." "Now, devise a plan." "Carry out the plan"

 

 

# Step 1: Prompting for Reasoning Generation

 

zero-shot CoT prompting 예시 -> 정답 오류

Q : In a dance class of 20 students, 20% enrolled in contemporary dance, 25% of the remaining enrolled in jazz dance, and the rest enrolled in hip-hot dance. what percentage of the entire students enrolled in hip-hop dance

P: Let's think step by step

A : First, 20% of the class enrolled in contemporary dance, so that means that 80% of the class is left

next, 25% of the remaining 80% enrolled in jazz dance, so that meas that 25% of the original class enrolled in jazz dance. that leaves 55% of the original class

finally, the rest of the clas (55%) enrolled in hip-hop dance. So, 55% of the entire class enrolled in hip-hop dance

Q : 20명의 학생으로 구성된 댄스 수업에서 20%는 현대무용에, 나머지 25%는 재즈댄스에, 나머지는 힙합 댄스에 등록했습니다. 전체 학생 중 힙합 댄스에 등록한 비율은 몇 퍼센트입니까
P : 차례로 생각해보자

A:
먼저, 수업의 20%가 현대무용에 등록했기 때문에 수업의 80%가 남습니다

다음으로, 나머지 80%의 25%가 재즈 댄스에 등록했습니다. 이는 원래 수업의 25%가 재즈 댄스에 등록한 것을 의미합니다. 이는 원래 수업의 55%를 남깁니다

마지막으로 나머지 반(55%)은 힙합 댄스에 등록했습니다. 그래서 전체 반의 55%가 힙합 댄스에 등록했습니다

 

Plan-and_Solve prompting 예시 -> 정답


Q : In a dance class of 20 students, 20% enrolled in contemporary dance, 25% of the remaining enrolled in jazz dance, and the rest enrolled in hip-hot dance. what percentage of the entire students enrolled in hip-hop dance
P: Let's first understand the problem and devise a plan to solve the problem.
Then, let's carry out the plan and solve the problem step by step.

A:
Plan:
Step 1: Calculate the total number of students who enrolled in contemporary and jazz dance.
Step 2: Calculate the total number of students who enrolled in hip-hop dance.
Step 3: Calculate the percentage of students who enrolled in hip-hop dance.

Solution:
Step 1: 20% of 20 students is 4 students. 25% of the remaining 16 students is 4 students. So, a total of 8 students enrolled in contemporary and jazz dance.
Step 2: The remaining 12 students enrolled in hip-hop dance.
Step 3: The percentage of students who enrolled in hip-hop dance is 12/20 = 60%



Q : 20명의 학생으로 구성된 댄스 수업에서 20%는 현대무용에, 나머지 25%는 재즈댄스에, 나머지는 힙합 댄스에 등록했습니다. 전체 학생 중 힙합 댄스에 등록한 비율은 몇 퍼센트입니까

P : 먼저 문제를 이해하고 문제를 해결하기 위한 계획을 세웁니다.
그런 다음 계획을 실행하고 단계별로 문제를 해결해 보겠습니다.
A:
계획:
1단계: 현대무용과 재즈댄스에 등록한 총 학생 수를 계산합니다.
2단계: 힙합 댄스에 등록한 총 학생 수를 계산합니다.
3단계: 힙합 댄스에 등록한 학생의 비율을 계산합니다.

해결책:
1단계: 20명의 학생 중 20%는 4명입니다. 나머지 16명의 학생 중 25%는 4명입니다. 따라서 총 8명의 학생이 현대무용과 재즈댄스에 등록했습니다.
2단계: 나머지 12명의 학생들은 힙합 댄스에 등록했습니다.
3단계: 힙합 댄스에 등록한 학생의 비율은 12/20 = 60%입니다

성능향상 이유 : 

1. ‘계획 수립 → 계획 실행’의 단계적 구조를 따르도록 프롬프트를 설계했습니다. 즉, 문제를 여러 하위 작업으로 나누고, 이를 차례대로 해결하도록 명확한 방향을 제시해 추론 흐름이 일관되고 논리적입니다.

2. 추가 지침으로 변수 추출, 중간 계산 시 주의 등을 포함한 PS+ 프롬프팅 

 

 

# Step 2: Prompting for Answer Extraction

Plan-and_Solve prompting 예시 -> 정답 오류

 Q :Grace weighs 125 pounds, Alex weighs 2 pounds less than 4 times what Grace weights. what are their combined weights in pounds ?

P: Let's first understand the problem and devise a plan to solve the problem. then let's carry out the plan and solve the problem step by step

A:..

Q:그레이스의 몸무게는 125파운드이고, 알렉스의 몸무게는 그레이스의 몸무게의 4배보다 2파운드 적습니다. 두 사람의 몸무게를 합친 파운드 단위는 얼마인가요?

P: 먼저 문제를 이해하고 문제를 해결하기 위한 계획을 세웁니다. 그런 다음 계획을 실행하고 단계별로 문제를 해결합시다

A : 497 pounds

Plan-and_Solve prompting with more detailed instructions ( PS +) -> 정답

Q :Grace weighs 125 pounds, Alex weighs 2 pounds less than 4 times what Grace weights. what are their combined weights in pounds ?

P: Let's first undestand the problem, extract relevant variables and their corresponding numberals, and devise a plan. then, let's carry out the plan, calculate intermediate results (pay attention to calcuation and common sense), solve the problem step by step, and show the answer

A:...


Q:그레이스의 몸무게는 125파운드이고, 알렉스의 몸무게는 그레이스의 몸무게의 4배보다 2파운드 적습니다. 두 사람의 몸무게를 합친 파운드 단위는 얼마인가요?

P: 먼저 문제를 풀고 관련 변수와 그에 상응하는 수치를 추출한 다음 계획을 수립합니다. 그런 다음 계획을 실행하고 중간 결과를 계산(계산과 상식에 주의)한 다음 단계별로 문제를 해결한 다음 답을 보여드리겠습니다.

A :

step : 1
Grace : 125
Alex : x

step : 2
Alex : 125 * 4 


step : 3
Alex : 500-2


step : 4
combine 125+ 498 : 623

 

상세한 프롬프트를 통해 성능 향상 가능함

#  한계점


 LLM이 올바른 추론 단계를 생성하도록 유도하는 프롬프트를 설계하는 데 노력이 많이 든다.
둘째, 제안된 Plan-and-Solve 프롬프트 전략은 계산 오류와 추론 단계 누락 오류를 줄이는 데에는 도움이 되지만, semantic misunderstanding errors 유지.