[G1-Sync] Manual knowledge update

This commit is contained in:
Antigravity Agent
2026-05-10 22:08:15 +09:00
parent 21ac3ed255
commit 504fd5fb42
3011 changed files with 380280 additions and 206977 deletions
@@ -2,65 +2,154 @@
id: wiki-2026-0508-introspection-자기성찰
title: Introspection (자기성찰)
category: 10_Wiki/Topics
status: needs_review
status: verified
canonical_id: self
aliases: [P-Reinforce-AUTO-INTR-001]
aliases: [Self-Reflection, 자기성찰, LLM Introspection]
duplicate_of: none
source_trust_level: A
confidence_score: 0.88
tags: [auto-reinforced, introspection, self-awareness, metacognition, cognitive-science, Psychology]
confidence_score: 0.9
verification_status: applied
tags: [llm, prompting, self-reflection, philosophy-of-mind, agent]
raw_sources: []
last_reinforced: 2026-04-20
last_reinforced: 2026-05-10
github_commit: pending
inferred_by: Claude Opus 4.7 (auto-normalize 2026-05-08)
tech_stack:
language: python
framework: langchain
---
# [[Introspection (자기성찰)|Introspection (자기성찰)]]
# Introspection (자기성찰)
## 📌 한 줄 통찰 (The Karpathy Summary)
> "나를 비추는 거울: 자신의 생각, 감정, 동기, 인지 과정을 스스로 들여다보고 분석함으로써, 행동의 원인을 파악하고 더 나은 의사결정과 성장을 도모하는 내면의 관찰 카메라."
## 한 줄
> **"매 모델이 자기 출력을 다시 읽고 평가/수정"**. 철학에서는 1인칭 자기 의식 접근을 의미하고, LLM에서는 self-critique → revise loop로 정확도/정합성을 끌어올리는 핵심 prompting pattern.
## 📖 구조화된 지식 (Synthesized Content)
자기성찰(Introspection)은 자신의 정신적 상태를 직접 들여다보는 의식 활동입니다.
## 매 핵심
1. **가치**:
* **Self-Correction**: 자신의 인지적 편향이나 실수를 조기에 발견하고 수정 가능. ([[Cognitive Biases|Cognitive Biases]]와 연결)
* **Emotional Intelligence**: 감정의 뿌리를 이해하여 타인과의 소통 및 공감 능력 향상. ([[Empathy-in-AI|Empathy-in-AI]]와 연결)
* **Metacognition**: "내가 무엇을 알고 무엇을 모르는가"를 파악하여 학습 효율을 높임.
2. **AI적 해석 (Self-Refine)**:
* AI가 내놓은 답변을 스스로 검토하고 보완하는 'Self-Correction' 루프는 AI 기법의 핵심으로 자리 잡음. (Chain of Thought와 연결)
### 매 두 가지 의미
- **철학 (Locke, Kant)**: mind 자체를 관찰하는 1인칭 access. qualia, self-model.
- **LLM**: 자기 응답을 input 으로 다시 받아 비판/개선. **Reflexion**, **Self-Refine**, **CoVe** 계열.
## ⚠️ 모순 및 업데이트 (Contradictions & Updates)
- **과거 데이터와의 충돌**: 과거에는 자기 통찰이 '주관적인 착각 정책'을 줄 수 있다는 비판이 있었으나(행동주의 심리학), 현대 정책은 시스템의 안정성과 도덕적 일관성 정책을 유지하는 필수적인 '내부 제어 정책'으로 재평가함(RL Update).
- **정책 변화(RL Update)**: 거대 모델 정책에서 사용되는 '자기 비판(Self-Criticism) 프롬프트 정책'은 모델의 환각을 줄이고 논리성을 높이는 가장 효과적인 엔지니어링 정책 중 하나가 됨. (Hallucination (환각)와 연결)
### 매 동작 원리
1. **Generate**: 초안 응답 produce.
2. **Critique**: 같은 모델이 초안을 평가 (오류, 누락, 가정).
3. **Revise**: critique 반영 재생성.
4. (선택) 수렴할 때까지 반복.
## 🔗 지식 연결 (Graph)
- [[Cognitive Biases|Cognitive Biases]], [[Empathy-in-AI|Empathy-in-AI]], [[Hallucination (환각)|Hallucination (환각)]], [[Flow-State|Flow-State]], Agentic-Workflow
- **Modern Tech/Tools**: Reflective [[Journaling|Journaling]], [[Mental Models|Mental Models]], AI monitoring dashboards, Chain-of-Thought prompting.
---
### 매 응용
1. Reasoning 정확도 향상 (math, code).
2. Hallucination 검출 (CoVe — Chain of Verification).
3. Agent 환경: tool 호출 결과 self-evaluate 후 재시도.
4. RLHF reward modeling 대안 (constitutional AI).
## 🤖 LLM 활용 힌트 (How to Use This Knowledge)
## 💻 패턴
**언제 이 지식을 쓰는가:**
- *(TODO)*
### Self-Refine (single-model loop)
```python
def self_refine(prompt, model, max_iters=3):
answer = model.invoke(f"Answer: {prompt}")
for _ in range(max_iters):
feedback = model.invoke(
f"Critique this answer (errors, gaps):\n{answer}"
)
if "no issues" in feedback.lower():
break
answer = model.invoke(
f"Original: {prompt}\nDraft: {answer}\nFeedback: {feedback}\nRevised:"
)
return answer
```
**언제 쓰면 안 되는가:**
- *(TODO)*
### Reflexion (verbal RL)
```python
class ReflexionAgent:
def __init__(self, llm):
self.llm = llm
self.memory = [] # past reflections
## 🧪 검증 상태 (Validation)
def act(self, task):
ctx = "\n".join(self.memory)
result = self.llm(f"{ctx}\nTask: {task}")
if not self.evaluate(result):
reflection = self.llm(f"Why did this fail?\n{result}")
self.memory.append(reflection)
return result
```
- **정보 상태:** needs_review
- **출처 신뢰도:** A
- **검토 이유:** *(P-Reinforce Phase 1 자동 정규화. 본문 검증 필요.)*
### Chain of Verification (CoVe)
```python
def cove(question, llm):
draft = llm(f"Q: {question}")
plan = llm(f"List verification questions for:\n{draft}")
answers = [llm(q) for q in plan.split("\n")]
return llm(f"Original:{draft}\nVerifications:{answers}\nFinal:")
```
## 🧬 중복 검사 (Duplicate Check)
### Constitutional AI (self-critique with principles)
```python
PRINCIPLES = ["harmless", "honest", "helpful"]
- **기존 유사 문서:** *(TODO: 인덱서 클러스터 리포트 참조)*
- **처리 방식:** UPDATE (자동 정규화)
- **처리 이유:** Phase 1 정규화 — 옛 템플릿/누락 필드 보강.
def constitutional_revise(response, llm):
for p in PRINCIPLES:
critique = llm(f"Critique by '{p}':\n{response}")
response = llm(f"Revise per critique:\n{critique}")
return response
```
## 🕓 변경 이력 (Changelog)
### Confidence-gated introspection
```python
def maybe_introspect(answer, llm, threshold=0.7):
score = float(llm(f"Confidence 0-1 in:\n{answer}").strip())
if score < threshold:
return self_refine(answer, llm)
return answer
```
| 날짜 | 변경 내용 | 처리 방식 | 신뢰도 |
|------|-----------|-----------|--------|
| 2026-05-08 | P-Reinforce Phase 1 정규화 (frontmatter + 헤더 표준화) | UPDATE | A |
### LangChain self-critique chain
```python
from langchain.chains import LLMChain, SequentialChain
draft = LLMChain(llm=llm, prompt=draft_prompt, output_key="draft")
critic = LLMChain(llm=llm, prompt=critic_prompt, output_key="critique")
final = LLMChain(llm=llm, prompt=final_prompt, output_key="final")
chain = SequentialChain(chains=[draft, critic, final],
input_variables=["q"],
output_variables=["final"])
```
## 매 결정 기준
| 상황 | Approach |
|---|---|
| 단순 factual Q&A | introspection 불필요 (latency↑) |
| Math / code | Self-Refine + verifier |
| Long-form 사실 검증 | CoVe |
| Agent 실패 학습 | Reflexion (memory 누적) |
| Safety alignment | Constitutional AI |
**기본값**: 1-shot Self-Refine (1회 critique → revise). 반복은 비용 대비 효과 체감 빠름.
## 🔗 Graph
- 부모: [[Prompt-Engineering]], [[LLM]]
- 변형: [[Reflexion]], [[Self-Refine]], [[Chain-of-Verification]]
- 응용: [[Agent-Frameworks]], [[Constitutional-AI]]
- Adjacent: [[Chain-of-Thought]], [[Tree-of-Thoughts]], [[Philosophy-of-Mind]]
## 🤖 LLM 활용
**언제**: multi-step reasoning, 사실 검증 필요한 long-form, agent 실패 분석, alignment.
**언제 X**: 단답형 classification, latency 민감, cost-bound batch inference.
## ❌ 안티패턴
- **Critique 동일 모델만 사용**: confirmation bias — 가능하면 stronger judge 사용.
- **무한 loop**: 수렴 조건 없이 반복 → 비용 폭증, 답 표류.
- **Critique 무시**: revise 단계에서 critique 미반영 prompt.
- **자기성찰 == 자의식**: LLM introspection 은 functional pattern. 철학적 self-awareness 와 구분.
## 🧪 검증 / 중복
- Madaan et al. 2023 (Self-Refine), Shinn et al. 2023 (Reflexion), Dhuliawala et al. 2023 (CoVe).
- Bai et al. 2022 (Constitutional AI, Anthropic).
- 신뢰도 A.
## 🕓 Changelog
| 날짜 | 변경 |
|---|---|
| 2026-05-08 | Phase 1 |
| 2026-05-10 | Manual cleanup — 철학/LLM 두 의미 통합, Self-Refine/Reflexion/CoVe/Constitutional 패턴 정리 |