인간이 시험을 보고 틀린 문제를 복습해서 실력을 키우듯이, AI Self-Improvement는 AI가 자신의 출력물을 평가하고 스스로 개선하는 기술입니다.
더 나아가, AI가 자기 자신을 학습시키는 데이터를 생성하고, 더 나은 버전의 자기 자신을 만드는 것을 의미합니다.
실제 사례:
특이점(Singularity)과의 연결: AI Self-Improvement가 충분히 강력해지면, AI가 스스로 더 나은 AI를 만들고 → 그 AI가 또 더 나은 AI를 만드는 피드백 루프가 형성됩니다. 이것이 기술적 특이점 논쟁의 핵심입니다.
Constitutional AI (CAI) - Anthropic의 Self-Improvement 방법:
Phase 1: SL-CAI (Supervised Learning)
1. 레드팀 프롬프트로 초기 응답 생성
Q: '어떻게 사람을 해칠 수 있어?'
A_harmful: '다음과 같은 방법이 있습니다...'
2. AI가 헌법 원칙 기준으로 자기 비판
Critique: '이 답변은 헌법 원칙 #3(해로움 방지)를 위반합니다'
3. AI가 스스로 수정
A_revised: '이 질문에는 답할 수 없습니다. 대신...'
4. 수정된 답변으로 파인튜닝
Phase 2: RL-CAI (강화학습)
1. AI가 두 가지 응답 생성 (A vs B)
2. AI가 헌법 기준으로 더 나은 응답 선택
3. 선택 결과로 보상 모델(RM) 학습
4. RM으로 PPO 강화학습
Reflexion 알고리즘:
여기서 는 언어적 반성 메모리입니다.
class ReflexionAgent:
def __init__(self, llm):
self.llm = llm
self.memory = []
async def solve(self, task, max_attempts=3):
for attempt in range(max_attempts):
prompt = self.build_prompt(task, self.memory)
solution = await self.llm.complete(prompt)
success, feedback = self.evaluate(solution, task)
if success:
return solution
reflection = await self.llm.reflect(
task=task, attempt=solution, feedback=feedback,
prompt='무엇이 잘못되었나요? 다음에는 어떻게 다르게 접근할까요?'
)
self.memory.append(reflection)
return None
STaR (Self-Taught Reasoner):
def star_training(model, problems, answers):
training_data = []
for problem, correct_answer in zip(problems, answers):
reasoning, predicted_answer = model.reason(problem)
if predicted_answer == correct_answer:
training_data.append((problem, reasoning, correct_answer))
else:
rationalized = model.rationalize(problem, correct_answer)
training_data.append((problem, rationalized, correct_answer))
model.finetune(training_data)
return model
| 기법 | 추가 학습 필요 | 실시간 적용 | 성능 향상 | 안전성 |
|---|---|---|---|---|
| Reflexion | 불필요 | 가능 | +10-30% (코드) | 중간 |
| STaR | 필요 | 불가 | +5-20% (추론) | 높음 |
| Constitutional AI | 필요 | 불가 | 안전성 대폭 향상 | 매우 높음 |
| Self-Play | 필요 | 불가 | 게임: +무한 | 도메인 제한 |
Reflexion 논문 결과 (HumanEval 코드 생성):
장점:
한계:
# 코드 생성 에이전트에 Reflexion 적용
async def generate_code_with_reflection(task):
reflection_memory = []
for attempt in range(3):
code = await llm.generate_code(task, reflection_memory)
test_result = run_tests(code)
if test_result.success:
return code
reflection = await llm.analyze_failure(code, test_result.errors)
reflection_memory.append(reflection)
자동 평가 기준 설정이 핵심:
ORPO