"매 program inspects itself, agent critiques itself". Reflection 은 dual concept — programming 에서 runtime 의 type/method introspection, AI 에서 LLM 의 self-critique loop. 2023 Reflexion paper (Shinn) 가 후자를 popularize, 2026 의 agent loop 의 backbone.
매 핵심
매 Programming Reflection
Java: Class.forName, Method.invoke — runtime type lookup.
Python: getattr, inspect, type() — first-class.
Go: reflect.ValueOf, reflect.TypeOf — verbose but explicit.
Rust: 매 limited — std::any::Any, no runtime method dispatch.
Cost: 매 10-100x slower than direct call. JIT 의 mitigates partially.
매 LLM Reflection
Reflexion (2023): agent generates → critiques → retries with verbal feedback in context.
Self-critique: 매 model evaluates own output against rubric/spec.
Constitutional AI: Anthropic 의 자기-revision against principles.
CRITIC (2024): tool-augmented self-correction.
Test-time compute (o1, Claude thinking): 매 internal reflection 의 productized.
매 응용
Agent error recovery — failed tool call 의 self-diagnose.
언제: 매 verifiable output (code passes tests, math 의 numerical), expensive failures (production agent), multi-step planning.
언제 X: simple Q&A (reflection 의 cost > benefit), creative generation (critique 의 collapse to mean), latency-critical (<500ms).
❌ 안티패턴
Infinite reflection: 매 max_iter cap 없음 → cost runaway.
Critic = generator: same model 의 critique 의 weak — 매 stronger verifier 의 use.
Reflection in hot path: Java/Go 의 production code 의 reflect.Value 의 hide.
Verbal-only critique: 매 numeric/test signal 없음 → noise.
Self-praise loop: critique prompt 의 "find ANY issue" 의 biased.
🧪 검증 / 중복
Verified (Reflexion paper 2023, Anthropic Constitutional AI, Java/Go reflect docs).