Files
2nd/10_Wiki/Topic_General/From_Other/Anticipation.md
T
Antigravity Agent 9148c358d0 docs(10_Wiki): 위키 전체 재구성 — Topic_* 폴더를 4개 카테고리로 통합 + 대규모 중복 제거
Topic_Agent/Topic_Blog/Topics/Topics_Biz/Topics_Meeting/Topics_Rag의 마크다운 지식 문서를
Topic_General/Topic_Programming/Topic_Graphic/Topic_Business 4개 카테고리로 재분류.

- 중복 제거: frontmatter의 status:duplicate/merged + duplicate_of/redirect_to 필드로
  자기 자신을 중복으로 선언한 리다이렉트 stub 1032개 제거, 완전 동일 내용 파일 472개 제거,
  동일 파일명·다른 내용 충돌 시 더 큰(완전한) 버전만 유지(162개 제거) — 총 1639개 중복 제거.
- 분류: 폴더 단위로 명확한 항목(AI_and_ML/Coding/Architecture 등 → Programming,
  Comfyui/Visual_Effects → Graphic, Topics_Biz/Topics_Meeting/사업 등 → Business,
  Poetic_Blog_Writing/창의성/Game_Design 등 → General)은 폴더 우선순위로,
  나머지 혼재 폴더(Topic_Agent/Topic_Blog/Topics 루트/Thinking & Reasoning/Other/UI_UX_Assets)는
  title/tags 키워드 스코어링으로 파일 단위 분류(불명확한 경우 General로 폴백).
  원본 폴더명은 "From_*" 서브폴더로 보존해 추적 가능성 유지.
- 최종 배치: Programming 2784 / General 1608 / Graphic 285 / Business 249 = 4926개 문서.
- 에이전트 운영 상태(.astra/.agent/.obsidian/sessions/memory/_company/docs/lessons/_shared/src)는
  지식 콘텐츠가 아니므로 재분류 대상에서 제외하고 원위치 유지.
- Topics/Topic_email(상위 보호 폴더 Topic_email과 파일명 100% 중복) 삭제 — 보호 폴더 자체는 미변경.
- 완전히 비게 된 Topic_Agent/Topic_Blog/Topics_Biz/Topics_Rag 폴더 제거.
2026-07-05 00:33:48 +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 |