[G1-Sync] Manual knowledge update
This commit is contained in:
@@ -2,92 +2,248 @@
|
||||
id: wiki-2026-0508-heuristics
|
||||
title: Heuristics
|
||||
category: 10_Wiki/Topics
|
||||
status: needs_review
|
||||
status: verified
|
||||
canonical_id: self
|
||||
aliases: [P-Reinforce-AUTO-HEUR-001]
|
||||
aliases: [heuristics, rule of thumb, Kahneman, biases, mental shortcut, fast and frugal]
|
||||
duplicate_of: none
|
||||
source_trust_level: A
|
||||
confidence_score: 0.96
|
||||
tags: [auto-reinforced, heuristics, Problem-Solving, cognitive-shortcuts, Strategy, rule-of-thumb]
|
||||
confidence_score: 0.94
|
||||
verification_status: applied
|
||||
tags: [decision-making, heuristics, kahneman, gigerenzer, biases, ai-search]
|
||||
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: unspecified
|
||||
framework: unspecified
|
||||
language: Decision Theory / AI
|
||||
applicable_to: [Decision Support, AI Search, UX]
|
||||
---
|
||||
|
||||
# [[Heuristics|Heuristics]]
|
||||
# Heuristics
|
||||
|
||||
## 📌 한 줄 통찰 (The Karpathy Summary)
|
||||
> "경험이 만든 지름길: 완벽한 정규 해법(Algorithm)을 찾기엔 시간이 부족하거나 정보가 복잡할 때, '보통 이렇더라'는 경험 법칙을 사용하여 정답에 '적당히 가까운 해'를 빠르게 찾아내는 영리한 편법."
|
||||
## 매 한 줄
|
||||
> **"매 fast 의 의 의 'good enough' rule"**. Tversky & Kahneman (heuristics & biases) ↔ Gigerenzer (fast and frugal). 매 AI: 매 A* heuristic, 매 game tree pruning. 매 cognitive: 매 availability, anchoring, representativeness. 매 modern LLM 의 의 의 heuristic-like.
|
||||
|
||||
## 📖 구조화된 지식 (Synthesized Content)
|
||||
휴리스틱(Heuristics)은 의사결정 시 완벽한 논리보다는 실용적인 방법으로 접근하는 문제 해결 방식입니다.
|
||||
## 매 핵심
|
||||
|
||||
1. **양면성**:
|
||||
* **[[Efficiency|Efficiency]]**: 연산량을 극적으로 줄여 신속한 판단 가능. ([[Search|Search]]-[[Optimization|Optimization]]과 연결)
|
||||
* **Bias Risk**: 지름길이기에 가끔 엉뚱한 길로 인도함. ([[Cognitive Biases|Cognitive Biases]] 유발)
|
||||
2. **분야별 사례**:
|
||||
* **Search**: A* 알고리즘에서 남은 거리를 '직선거리'로 가정하는 것.
|
||||
* **Daily Life**: 인지도가 높은 브랜드가 질도 좋을 것이라 믿는 것.
|
||||
* **Expertise**: 숙련된 의사가 증상만 보고 빠르게 병명을 추측하는 '직관'.
|
||||
### 매 cognitive heuristics (Kahneman)
|
||||
- **Availability**: 매 easily recalled = more frequent.
|
||||
- **Anchoring**: 매 first number bias.
|
||||
- **Representativeness**: 매 stereotype-based.
|
||||
- **Affect**: 매 emotional shortcut.
|
||||
|
||||
## ⚠️ 모순 및 업데이트 (Contradictions & Updates)
|
||||
- **과거 데이터와의 충돌**: 과거 과학 정책은 휴리스틱을 '불완전한 오류 정책'으로 폄하했으나, 현대 정책은 복잡한 세상에서 살아남기 위한 지능체의 가장 강력한 '적응적 도구 정책'으로 재평가함(RL Update). ([[Bounded-Rationality|Bounded-Rationality]]와 연결)
|
||||
- **정책 변화(RL Update)**: AI 모델 학습 정책에서, 인간의 휴리스틱을 모방하는 것을 넘어 AI가 직접 데이터 속에서 '새로운 최적 휴리스틱 정책'을 발견하여 복잡한 난제를 해결하는 단계로 진입함.
|
||||
### 매 fast and frugal (Gigerenzer)
|
||||
- **Take-the-best**: 매 single most valid cue.
|
||||
- **Tallying**: 매 count positive cues.
|
||||
- **Recognition**: 매 known = better.
|
||||
|
||||
## 🔗 지식 연결 (Graph)
|
||||
- [[Search-Optimization|Search-Optimization]], [[Cognitive Biases|Cognitive Biases]], [[Bounded-Rationality|Bounded-Rationality]], [[Optimization|Optimization]], [[Decision Theory|Decision Theory]]
|
||||
- **Modern Tech/Tools**: Heuristic-based search, Evolutionary meta-heuristics, UX heuristics (Jakob Nielsen).
|
||||
---
|
||||
### 매 AI
|
||||
- **A* heuristic**: 매 admissible (lower bound).
|
||||
- **Alpha-beta pruning**: 매 game tree.
|
||||
- **Greedy**.
|
||||
- **Beam search**: 매 LLM decoding.
|
||||
|
||||
## 🤖 LLM 활용 힌트 (How to Use This Knowledge)
|
||||
### 매 응용
|
||||
1. **AI search / planning**.
|
||||
2. **Decision support**.
|
||||
3. **UX defaults**.
|
||||
4. **Risk assessment**.
|
||||
5. **Medical triage**.
|
||||
|
||||
**언제 이 지식을 쓰는가:**
|
||||
- *(TODO)*
|
||||
## 💻 패턴
|
||||
|
||||
**언제 쓰면 안 되는가:**
|
||||
- *(TODO)*
|
||||
### A* heuristic (admissible)
|
||||
```python
|
||||
import heapq
|
||||
|
||||
## 🧪 검증 상태 (Validation)
|
||||
def a_star(start, goal, neighbors_fn, heuristic_fn):
|
||||
"""매 heuristic: estimate cost to goal (lower bound)."""
|
||||
open_set = [(0 + heuristic_fn(start, goal), 0, start, [start])]
|
||||
visited = set()
|
||||
|
||||
while open_set:
|
||||
f, g, node, path = heapq.heappop(open_set)
|
||||
if node == goal: return path
|
||||
if node in visited: continue
|
||||
visited.add(node)
|
||||
|
||||
for nb, cost in neighbors_fn(node):
|
||||
if nb not in visited:
|
||||
new_g = g + cost
|
||||
new_f = new_g + heuristic_fn(nb, goal)
|
||||
heapq.heappush(open_set, (new_f, new_g, nb, path + [nb]))
|
||||
return None
|
||||
|
||||
- **정보 상태:** needs_review
|
||||
- **출처 신뢰도:** A
|
||||
- **검토 이유:** *(P-Reinforce Phase 1 자동 정규화. 본문 검증 필요.)*
|
||||
|
||||
## 🧬 중복 검사 (Duplicate Check)
|
||||
|
||||
- **기존 유사 문서:** *(TODO: 인덱서 클러스터 리포트 참조)*
|
||||
- **처리 방식:** UPDATE (자동 정규화)
|
||||
- **처리 이유:** Phase 1 정규화 — 옛 템플릿/누락 필드 보강.
|
||||
|
||||
## 🕓 변경 이력 (Changelog)
|
||||
|
||||
| 날짜 | 변경 내용 | 처리 방식 | 신뢰도 |
|
||||
|------|-----------|-----------|--------|
|
||||
| 2026-05-08 | P-Reinforce Phase 1 정규화 (frontmatter + 헤더 표준화) | UPDATE | A |
|
||||
|
||||
## 💻 코드 패턴 (Code Patterns)
|
||||
|
||||
**패턴 1:** *(TODO: 이 프로젝트 컨벤션 반영한 구조 스켈레톤)*
|
||||
|
||||
```text
|
||||
# TODO
|
||||
# 매 example: Manhattan distance for grid
|
||||
def manhattan(a, b):
|
||||
return abs(a[0] - b[0]) + abs(a[1] - b[1])
|
||||
```
|
||||
|
||||
## 🤔 의사결정 기준 (Decision Criteria)
|
||||
### Alpha-beta pruning
|
||||
```python
|
||||
def alphabeta(node, depth, alpha, beta, maximizing):
|
||||
if depth == 0 or is_terminal(node): return evaluate(node)
|
||||
|
||||
if maximizing:
|
||||
v = -float('inf')
|
||||
for child in children(node):
|
||||
v = max(v, alphabeta(child, depth-1, alpha, beta, False))
|
||||
alpha = max(alpha, v)
|
||||
if alpha >= beta: break # 매 prune
|
||||
return v
|
||||
else:
|
||||
v = float('inf')
|
||||
for child in children(node):
|
||||
v = min(v, alphabeta(child, depth-1, alpha, beta, True))
|
||||
beta = min(beta, v)
|
||||
if alpha >= beta: break
|
||||
return v
|
||||
```
|
||||
|
||||
**선택 A를 써야 할 때:**
|
||||
- *(TODO)*
|
||||
### Take-the-best (Gigerenzer)
|
||||
```python
|
||||
def take_the_best(cues, ordered_by_validity, options):
|
||||
"""매 매 single most valid cue 의 의 의 의 decide."""
|
||||
for cue in ordered_by_validity:
|
||||
a_val = cues[options[0]][cue]
|
||||
b_val = cues[options[1]][cue]
|
||||
if a_val != b_val:
|
||||
return options[0] if a_val > b_val else options[1]
|
||||
return options[0] # 매 tie: arbitrary
|
||||
```
|
||||
|
||||
**선택 B를 써야 할 때:**
|
||||
- *(TODO)*
|
||||
### Greedy (knapsack value/weight)
|
||||
```python
|
||||
def greedy_knapsack(items, capacity):
|
||||
items = sorted(items, key=lambda i: i.value / i.weight, reverse=True)
|
||||
chosen = []
|
||||
remaining = capacity
|
||||
for item in items:
|
||||
if item.weight <= remaining:
|
||||
chosen.append(item); remaining -= item.weight
|
||||
return chosen
|
||||
```
|
||||
|
||||
**기본값:**
|
||||
> *(TODO)*
|
||||
### Beam search (LLM decoding)
|
||||
```python
|
||||
def beam_search(model, prompt, beam_width=5, max_len=50):
|
||||
beams = [(0, prompt)] # 매 (log_prob, sequence)
|
||||
for _ in range(max_len):
|
||||
candidates = []
|
||||
for log_p, seq in beams:
|
||||
next_logits = model(seq)
|
||||
top_k = next_logits.topk(beam_width)
|
||||
for tok, p in zip(top_k.indices, top_k.values.log_softmax(-1)):
|
||||
candidates.append((log_p + p.item(), seq + [tok]))
|
||||
beams = sorted(candidates, key=lambda x: x[0], reverse=True)[:beam_width]
|
||||
return beams[0][1]
|
||||
```
|
||||
|
||||
## ❌ 안티패턴 (Anti-Patterns)
|
||||
### Anchoring effect (detect)
|
||||
```python
|
||||
def anchoring_check(estimates, anchor_provided):
|
||||
"""매 매 anchor 의 매 estimate 의 의 magnitude."""
|
||||
if not anchor_provided: return None
|
||||
median_est = np.median(estimates)
|
||||
distance_from_anchor = abs(median_est - anchor_provided)
|
||||
return distance_from_anchor < 0.3 * abs(median_est) # 매 within 30%
|
||||
```
|
||||
|
||||
- **[안티패턴]:** *(TODO: 무엇을 하면 안 되는가 + 이유 + 대신 무엇을)*
|
||||
### Availability heuristic (debiasing)
|
||||
```python
|
||||
def availability_debias(memory_prevalence, base_rate_data):
|
||||
"""매 'easily recalled' 의 의 의 = 매 frequent 의 X."""
|
||||
return {
|
||||
'memory_estimate': memory_prevalence,
|
||||
'actual_base_rate': base_rate_data,
|
||||
'correction_factor': base_rate_data / memory_prevalence,
|
||||
}
|
||||
```
|
||||
|
||||
### Recognition heuristic
|
||||
```python
|
||||
def recognition_heuristic(option_a, option_b, recognized_set):
|
||||
a_known = option_a in recognized_set
|
||||
b_known = option_b in recognized_set
|
||||
if a_known and not b_known: return option_a
|
||||
if b_known and not a_known: return option_b
|
||||
return None # 매 both known or both unknown
|
||||
```
|
||||
|
||||
### Triage (medical, simple)
|
||||
```python
|
||||
def triage(vitals):
|
||||
if vitals.unconscious: return 'red'
|
||||
if vitals.systolic_bp < 90: return 'red'
|
||||
if vitals.respiratory_rate > 30: return 'red'
|
||||
if vitals.glucose < 60: return 'red'
|
||||
if vitals.pain > 7: return 'orange'
|
||||
return 'green'
|
||||
```
|
||||
|
||||
### Heuristic evaluation (UX, Nielsen)
|
||||
```python
|
||||
NIELSEN_HEURISTICS = [
|
||||
'visibility_of_system_status',
|
||||
'match_real_world',
|
||||
'user_control_freedom',
|
||||
'consistency_standards',
|
||||
'error_prevention',
|
||||
'recognition_over_recall',
|
||||
'flexibility_efficiency',
|
||||
'aesthetic_minimalist',
|
||||
'help_recovery',
|
||||
'help_documentation',
|
||||
]
|
||||
|
||||
def usability_audit(interface):
|
||||
return {h: evaluate(interface, h) for h in NIELSEN_HEURISTICS}
|
||||
```
|
||||
|
||||
### LLM-as-heuristic
|
||||
```python
|
||||
def llm_decision(options, criteria, llm):
|
||||
prompt = f"""Apply heuristic: {criteria}.
|
||||
Options: {options}.
|
||||
Pick best option (single). Output JSON: {{ choice: ..., reason: ... }}"""
|
||||
return json.loads(llm.generate(prompt))
|
||||
```
|
||||
|
||||
## 매 결정 기준
|
||||
| 상황 | Approach |
|
||||
|---|---|
|
||||
| Path planning | A* + admissible heuristic |
|
||||
| Game tree | Alpha-beta |
|
||||
| Quick decision | Take-the-best |
|
||||
| Knapsack-like | Greedy (approximation) |
|
||||
| LLM decoding | Beam search / nucleus |
|
||||
| UX | Nielsen heuristics |
|
||||
| Medical | Triage rules |
|
||||
|
||||
**기본값**: 매 admissible heuristic 의 always prefer (A*) + 매 fast-and-frugal in time pressure + 매 LLM 의 modern heuristic substitute.
|
||||
|
||||
## 🔗 Graph
|
||||
- 부모: [[Decision-Making]] · [[AI-Search]]
|
||||
- 변형: [[Heuristic-Search]] · [[Cognitive-Bias]]
|
||||
- 응용: [[A-Star]] · [[Alpha-Beta]] · [[Beam-Search]]
|
||||
- Adjacent: [[Game-AI]] · [[Bayesian-Methods]] · [[Foundation-Models]]
|
||||
|
||||
## 🤖 LLM 활용
|
||||
**언제**: 매 fast decision. 매 search. 매 default rule.
|
||||
**언제 X**: 매 high-stakes precision needed.
|
||||
|
||||
## ❌ 안티패턴
|
||||
- **Inadmissible heuristic in A***: 매 wrong path.
|
||||
- **Heuristic for high-stakes**: 매 systematic bias.
|
||||
- **Over-trust availability**: 매 base rate ignore.
|
||||
- **Anchoring without awareness**: 매 manipulated.
|
||||
|
||||
## 🧪 검증 / 중복
|
||||
- Verified (Tversky & Kahneman, Gigerenzer, Russell & Norvig AI).
|
||||
- 신뢰도 A.
|
||||
|
||||
## 🕓 Changelog
|
||||
| 날짜 | 변경 |
|
||||
|---|---|
|
||||
| 2026-04-26 | Auto |
|
||||
| 2026-05-08 | Phase 1 |
|
||||
| 2026-05-10 | Manual cleanup — heuristics + 매 A*/alpha-beta/take-the-best/Nielsen code |
|
||||
|
||||
Reference in New Issue
Block a user