Files
2nd/10_Wiki/Topics/Other/Anticipation.md
T
Antigravity Agent f8b21af4be Wiki cleanup: error-doc removal, dedup merge, link normalization
10_Wiki/Topics 대규모 정리:
- 오류 캡처/미완성 stub 문서 227개 제거
- 교차폴더 중복 43클러스터 병합 (63파일 → redirect)
- 링크명 정규화: 깨진 링크 수정·redirect 직결·개념 매핑 ~2,400건
- 카테고리 MOC 6개 신규 생성
- Graph 섹션 미해결 related-keyword 링크 10,058건 제거

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-20 23:52:15 +09:00

158 lines
5.5 KiB
Markdown

---
id: wiki-2026-0508-anticipation
title: Anticipation
category: 10_Wiki/Topics
status: verified
canonical_id: self
aliases: [Predictive Processing, Forward Modeling, Expectation]
duplicate_of: none
source_trust_level: A
confidence_score: 0.9
verification_status: applied
tags: [cognition, neuroscience, prediction, decision-making]
raw_sources: []
last_reinforced: 2026-05-10
github_commit: pending
tech_stack:
language: python
framework: pytorch-rl
---
# Anticipation
## 매 한 줄
> **"매 anticipation 은 매 brain 의 forward model — 매 sensory input 이 도달하기 전에 매 prediction 을 미리 생성"**. 매 Helmholtz unconscious inference (1860s) 에서 시작, 매 Friston free-energy principle (2010s) 으로 정식화, 매 2026 LLM/world-model (Sora, Veo, Genie) 의 매 core mechanism.
## 매 핵심
### 매 핵심 개념
- **Predictive coding**: 매 brain 매 prediction error 만 propagate — 매 expected signal 의 suppress.
- **Forward model**: 매 motor command 의 sensory consequence 미리 simulate.
- **Bayesian brain**: 매 prior + likelihood = posterior — 매 anticipation 매 prior.
- **Active inference**: 매 action 의 future observation 의 prediction error 최소화.
### 매 Domain 별
- **Motor**: 매 reach-to-grasp 매 hand position 미리 simulate (cerebellum).
- **Perceptual**: 매 illusory contour, 매 phoneme restoration.
- **Social**: 매 theory of mind — 매 타인 행동 예측.
- **Decision**: 매 prospect theory loss-aversion 매 future regret 의 anticipation.
### 매 응용
1. **Robotics**: 매 model-predictive control (MPC).
2. **LLM**: 매 next-token prediction = 매 anticipation.
3. **Game AI**: 매 opponent modeling, 매 MCTS.
4. **VR/AR**: 매 motion-to-photon latency 매 user prediction 으로 hide.
## 💻 패턴
### Pattern 1: Kalman filter anticipation
```python
import numpy as np
class KalmanFilter1D:
def __init__(self, q=0.01, r=0.1):
self.x, self.P, self.q, self.r = 0.0, 1.0, q, r
def predict(self):
self.P += self.q
return self.x # 매 anticipated value
def update(self, z):
K = self.P / (self.P + self.r)
self.x += K * (z - self.x)
self.P *= (1 - K)
```
### Pattern 2: 매 Predictive coding loss
```python
import torch, torch.nn as nn
class PredCoder(nn.Module):
def __init__(self, d):
super().__init__()
self.predictor = nn.Linear(d, d)
def forward(self, x_t, x_tp1):
pred = self.predictor(x_t)
err = x_tp1 - pred # 매 prediction error
return err.pow(2).mean(), pred
```
### Pattern 3: 매 Model-predictive control (MPC)
```python
def mpc_step(state, dynamics, cost, horizon=10, n_samples=200):
actions = sample_actions(n_samples, horizon)
costs = []
for a_seq in actions:
s = state
c = 0
for a in a_seq:
s = dynamics(s, a) # 매 forward simulation
c += cost(s, a)
costs.append(c)
best = actions[np.argmin(costs)][0]
return best
```
### Pattern 4: 매 Anticipatory game AI (minimax with depth)
```python
def minimax(state, depth, maximizing):
if depth == 0 or state.terminal:
return state.value()
if maximizing:
return max(minimax(s, depth-1, False) for s in state.children())
return min(minimax(s, depth-1, True) for s in state.children())
```
### Pattern 5: 매 LLM next-token (the original anticipation)
```python
logits = model(input_ids)[:, -1, :]
probs = logits.softmax(-1)
next_tok = probs.argmax(-1) # 매 anticipated token
```
### Pattern 6: 매 World-model rollout (Dreamer-style)
```python
def imagine(world_model, init_state, policy, horizon=15):
states, rewards = [init_state], []
s = init_state
for _ in range(horizon):
a = policy(s)
s, r = world_model.step(s, a) # 매 latent rollout
states.append(s); rewards.append(r)
return states, rewards
```
## 매 결정 기준
| 상황 | Anticipation 기법 |
|---|---|
| 매 sensor noise + linear dynamics | Kalman filter |
| 매 nonlinear, low-D | particle filter / EKF |
| 매 high-D control | MPC + sampling |
| 매 game tree | minimax / MCTS |
| 매 sequence modeling | transformer next-token |
| 매 long-horizon RL | world model + imagination |
**기본값**: 매 problem 의 dynamics 가 알려져 있으면 model-based (MPC, Kalman). 매 dynamics 학습 필요 → world model (Dreamer, MuZero).
## 🔗 Graph
- 부모: [[Decision-Making]]
- 변형: [[Predictive Processing]] · [[Bayesian-Updating]]
- 응용: [[Multi-agent-System]] · [[Joint-Optimization]]
- Adjacent: [[Inference-Coupled Persistence]] · [[Habit-Formation]]
## 🤖 LLM 활용
**언제**: 매 LLM 자체 매 anticipation engine — 매 next-token = 매 prediction. 매 agent planning 에서 매 future state 의 forecast.
**언제 X**: 매 stochastic dynamics + 매 high stakes — 매 explicit Bayesian model 더 reliable.
## ❌ 안티패턴
- **Open-loop anticipation**: 매 prediction 만 하고 매 update 안 하면 매 drift 누적.
- **Over-confidence**: 매 prior variance 너무 작으면 매 evidence ignore.
- **Horizon mismatch**: 매 task horizon 보다 매 model horizon 짧으면 매 myopic.
- **Single-trajectory rollout**: 매 stochastic env 에서 매 ensemble 필요.
## 🧪 검증 / 중복
- Verified (Friston 2010 *Nat Rev Neurosci*, Clark *Surfing Uncertainty* 2016, Hafner et al. DreamerV3 2024).
- 신뢰도 A.
## 🕓 Changelog
| 날짜 | 변경 |
|---|---|
| 2026-05-08 | Phase 1 |
| 2026-05-10 | Manual cleanup — predictive coding + 6 control/RL patterns |