↓ 본문으로 건너뛰기

Least-to-Most 프롬프팅 완벽 가이드: 복잡한 문제를 단계별로 분해하기

·710 단어수·2 분·
Rafael Yu
작성자
Rafael Yu
소프트웨어 개발자 & AI 애호가
목차

Least-to-Most 프롬프팅이란?
#

Least-to-Most 프롬프팅은 본질적으로 다음 두 단계로 문제를 푸는 접근법입니다(상황에 따라 단일 프롬프트로도 구현할 수 있습니다).

  • 1단계: 복잡한 문제를 더 단순한 하위 문제(subproblem)들로 분해합니다.
  • 2단계: 하위 문제를 순서대로 해결하며, 앞 단계의 결과를 다음 단계의 맥락으로 이어갑니다.

단일 프롬프트 예시
#

Q: 존은 블록으로 탑을 쌓는 데 3분, 무너뜨리는 데 2분이 걸립니다. 놀이 시간이 20분 남았을 때 몇 번이나 탑을 쌓고 무너뜨릴 수 있을까요? A: 이 문제를 풀려면 다음을 순서대로 구해야 합니다.

  • 한 사이클(쌓기 + 무너뜨리기)에 걸리는 총 시간을 계산합니다.
  • 20분 안에 몇 번의 완전한 사이클이 들어가는지 계산합니다.

Q: 에이미는 워터슬라이드 꼭대기까지 올라가는 데 4분, 내려오는 데 1분이 걸립니다. 15분 뒤에 슬라이드가 닫힌다면 몇 번 탈 수 있을까요? A:

제가 일반 Chain-of-Thought보다 이 기법을 더 선호하는 이유는, 문제를 명시적이고 관리 가능한 작은 단계로 나누기 때문에 어떤 작업에도 쉽게 적용할 수 있기 때문입니다. 실제 비교 실험에서도 다양한 추론 과제에서 기존 CoT보다 일관되게 높은 성능을 보였습니다.

바로 쓰는 3단계 프롬프트 템플릿
#

템플릿 1: 문제 분해용 Few-Shot 예시 생성
#

Your job is to generate few-shot examples for the following task: {{ task }}

Your few-shot examples should contain two parts: A problem, and the decomposed subproblems. It should follow the structure below:

"""
Problem: Problem description

Decomposed subproblems:
- Subproblem 1
- Subproblem 2
- Subproblem 3
"""

Your output should contain only the examples, no preamble.

템플릿 2: 현재 작업을 하위 문제로 분해
#

{{ task }}

List only the decomposed subproblems that must be solved before solving the task listed above. Your output should contain only the decomposed subproblems, no preamble.

Here are a few examples of problems and their respective decomposed subproblems: {{ few-shot-examples }}

템플릿 3: 하위 문제를 순서대로 해결해 최종 답 도출
#

Solve the following task by addressing the subproblems listed below.

Task: {{ task }}
Subproblems: {{ sub-problems }}

관련 추론 기법
#