[G1-Sync] Manual knowledge update
This commit is contained in:
@@ -1,91 +1,270 @@
|
||||
---
|
||||
id: wiki-2026-0508-computational-neuroscience-rl
|
||||
title: Computational Neuroscience RL
|
||||
title: Computational Neuroscience & Reinforcement Learning
|
||||
category: 10_Wiki/Topics
|
||||
status: needs_review
|
||||
status: verified
|
||||
canonical_id: self
|
||||
aliases: [P-Reinforce-AUTO-CNRL-001]
|
||||
aliases: [computational neuroscience RL, dopamine RPE, TD learning, basal ganglia, distributional RL, meta-RL]
|
||||
duplicate_of: none
|
||||
source_trust_level: A
|
||||
confidence_score: 0.94
|
||||
tags: [auto-reinforced, computational-neuroscience, Reinforcement-Learning, Dopamine, brain-model, reward-prediction-error, neuroscience]
|
||||
confidence_score: 0.9
|
||||
verification_status: applied
|
||||
tags: [neuroscience, reinforcement-learning, dopamine, td-learning, distributional-rl, meta-learning, schultz, bayesian-brain]
|
||||
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: neuroscience / RL
|
||||
applicable_to: [RL Algorithms, Brain Disease Models, Bio-Inspired AI]
|
||||
---
|
||||
|
||||
# [[Computational-Neuroscience-RL|Computational-Neuroscience-RL]]
|
||||
# Computational Neuroscience & RL
|
||||
|
||||
## 📌 한 줄 통찰 (The Karpathy Summary)
|
||||
> "지능의 생물학적 뿌리: 뇌의 도파민 시스템이 어떻게 '보상 예측 오차'를 계산하여 유기체의 행동을 최적화하는지 수학적으로 분석하여, 인간의 학습 메커니즘과 AI 강화학습 알고리즘 사이의 연결 고리를 밝히는 학문."
|
||||
## 매 한 줄
|
||||
> **"매 dopamine = 매 reward prediction error"**. Schultz 의 finding (1990s) → 매 TD-learning 의 mathematical equivalent. 매 brain ↔ AI 의 deepest connection. 매 modern: distributional RL, model-based, meta-RL.
|
||||
|
||||
## 📖 구조화된 지식 (Synthesized Content)
|
||||
강화학습의 계산 신경과학(Computational-Neuroscience-RL)은 뇌의 보상 시스템과 학습 알고리즘 사이의 상호 작용을 연구합니다.
|
||||
## 매 핵심
|
||||
|
||||
1. **도파민과 보상 예측 오차(RPE)**:
|
||||
* **Schultz의 발견**: 도파민 뉴런은 보상 그 자체보다 '기대했던 보상과 실제 보상의 차이'에 반응함.
|
||||
* **TD-Learning 연동**: 이는 인공지능의 시간차 학습(Temporal Difference Learning) 방식과 수학적으로 정확히 일치함. ([[Reinforcement Learning (RL)|Reinforcement Learning (RL)]]와 연결)
|
||||
2. **왜 중요한가?**:
|
||||
* AI 알고리즘이 단순히 수학적 기교가 아니라 생물학적 타당성(Bio[[Logic|Logic]]al Plausibility)을 갖췄음을 증명하며, 역으로 뇌 질환(중독, 파킨슨 등)을 이해하는 강력한 모델을 제공하기 때문임. ([[Research|Re[[Search]]-Framework]]와 연결)
|
||||
### Schultz 의 dopamine
|
||||
- 매 reward 자체 X — 매 reward prediction error (RPE).
|
||||
- **Positive RPE** (better than expected): dopamine ↑.
|
||||
- **Negative RPE** (worse): dopamine ↓.
|
||||
- → 매 TD-error 의 exact match.
|
||||
|
||||
## ⚠️ 모순 및 업데이트 (Contradictions & Updates)
|
||||
- **과거 데이터와의 충돌**: 과거에는 단순 보상 정책(Scalar reward)만 중요하게 여겼으나, 현대 정책은 뇌가 미래의 다양한 가능성 정책을 한꺼번에 시뮬레이션하는 '분포적 강화학습(Distributional RL) 정책'을 사용한다는 사실을 발견함(RL Update).
|
||||
- **정책 변화(RL Update)**: 이제는 단순 보상을 넘어, 모델 기반(Model-based) 사고와 전전두엽(PFC)의 메타 학습 정책(Meta-learning)을 통해 AI 가 어떻게 인간처럼 적은 데이터로도 빠르게 일반화 정책을 수행하는지 연구하는 방향으로 진화 중임. (Generalization와 연결)
|
||||
### TD Learning (Sutton-Barto)
|
||||
- $\delta_t = r_t + \gamma V(s_{t+1}) - V(s_t)$
|
||||
- 매 update: $V(s_t) \leftarrow V(s_t) + \alpha \delta_t$
|
||||
- 매 dopamine 신호 = 매 δ.
|
||||
|
||||
## 🔗 지식 연결 (Graph)
|
||||
- [[Reinforcement Learning (RL)|Reinforcement Learning (RL)]], [[Research-Framework|Research-Framework]], Generalization, [[State-Space|State-Space]], [[Sensitivity-Analysis|Sensitivity-Analysis]]
|
||||
- **Key Concepts**: Basal ganglia, Dopamine, [[Reward Prediction Error|Reward Prediction Error]] (RPE).
|
||||
---
|
||||
### 매 brain 의 RL circuit
|
||||
- **Basal ganglia**: 매 action selection (actor).
|
||||
- **VTA / SNc**: 매 dopamine source.
|
||||
- **Striatum**: 매 value function (critic).
|
||||
- **Prefrontal cortex**: 매 model-based planning.
|
||||
- **Hippocampus**: 매 episodic / replay.
|
||||
|
||||
## 🤖 LLM 활용 힌트 (How to Use This Knowledge)
|
||||
### 매 modern findings
|
||||
|
||||
**언제 이 지식을 쓰는가:**
|
||||
- *(TODO)*
|
||||
#### Distributional RL (Bellemare 2017, Dabney 2020)
|
||||
- 매 single value X — 매 distribution over rewards.
|
||||
- **Quantile Regression DQN, IQN**.
|
||||
- 매 brain 의 dopamine 의 distributional code.
|
||||
- 매 risk-sensitive.
|
||||
|
||||
**언제 쓰면 안 되는가:**
|
||||
- *(TODO)*
|
||||
#### Model-based RL
|
||||
- 매 prefrontal cortex 의 simulate.
|
||||
- 매 Dreamer, MuZero.
|
||||
- 매 sample efficiency.
|
||||
|
||||
## 🧪 검증 상태 (Validation)
|
||||
#### Meta-RL
|
||||
- 매 prefrontal cortex 의 fast adaptation.
|
||||
- 매 PEARL, RL².
|
||||
|
||||
- **정보 상태:** needs_review
|
||||
- **출처 신뢰도:** A
|
||||
- **검토 이유:** *(P-Reinforce Phase 1 자동 정규화. 본문 검증 필요.)*
|
||||
#### Successor representation
|
||||
- 매 hippocampus 의 cognitive map.
|
||||
- 매 transfer learning.
|
||||
|
||||
## 🧬 중복 검사 (Duplicate Check)
|
||||
#### Replay
|
||||
- 매 hippocampus 의 sleep replay.
|
||||
- 매 RL 의 Experience Replay.
|
||||
|
||||
- **기존 유사 문서:** *(TODO: 인덱서 클러스터 리포트 참조)*
|
||||
- **처리 방식:** UPDATE (자동 정규화)
|
||||
- **처리 이유:** Phase 1 정규화 — 옛 템플릿/누락 필드 보강.
|
||||
### 매 disease modeling
|
||||
- **Parkinson's**: 매 dopamine deficit → 매 RL 의 LR ↓.
|
||||
- **Addiction**: 매 RPE 의 hijack ([[Addiction-Neuroscience]]).
|
||||
- **Depression**: 매 negative RPE bias.
|
||||
- **OCD**: 매 model-based 의 over-engaged.
|
||||
- **Schizophrenia**: 매 prediction error precision 의 alter.
|
||||
|
||||
## 🕓 변경 이력 (Changelog)
|
||||
### 매 응용
|
||||
1. **AI design**: 매 brain-inspired RL.
|
||||
2. **Drug development**: 매 dopamine modulator.
|
||||
3. **BCI**: 매 reward signal interface.
|
||||
4. **Behavioral therapy**: 매 RPE 의 reframe.
|
||||
5. **Marketing / nudge**: 매 reward schedule design.
|
||||
|
||||
| 날짜 | 변경 내용 | 처리 방식 | 신뢰도 |
|
||||
|------|-----------|-----------|--------|
|
||||
| 2026-05-08 | P-Reinforce Phase 1 정규화 (frontmatter + 헤더 표준화) | UPDATE | A |
|
||||
## 💻 패턴
|
||||
|
||||
## 💻 코드 패턴 (Code Patterns)
|
||||
### TD(0) value learning
|
||||
```python
|
||||
import numpy as np
|
||||
|
||||
**패턴 1:** *(TODO: 이 프로젝트 컨벤션 반영한 구조 스켈레톤)*
|
||||
|
||||
```text
|
||||
# TODO
|
||||
class TDLearner:
|
||||
def __init__(self, n_states, alpha=0.1, gamma=0.95):
|
||||
self.V = np.zeros(n_states)
|
||||
self.alpha = alpha
|
||||
self.gamma = gamma
|
||||
|
||||
def update(self, state, reward, next_state):
|
||||
td_error = reward + self.gamma * self.V[next_state] - self.V[state]
|
||||
self.V[state] += self.alpha * td_error
|
||||
return td_error # 매 dopamine 신호 의 analog
|
||||
```
|
||||
|
||||
## 🤔 의사결정 기준 (Decision Criteria)
|
||||
### Q-Learning (off-policy)
|
||||
```python
|
||||
class QLearner:
|
||||
def __init__(self, n_states, n_actions, alpha=0.1, gamma=0.95, eps=0.1):
|
||||
self.Q = np.zeros((n_states, n_actions))
|
||||
self.alpha, self.gamma, self.eps = alpha, gamma, eps
|
||||
|
||||
def act(self, state):
|
||||
if np.random.random() < self.eps:
|
||||
return np.random.randint(self.Q.shape[1])
|
||||
return self.Q[state].argmax()
|
||||
|
||||
def update(self, s, a, r, s_next):
|
||||
td_target = r + self.gamma * self.Q[s_next].max()
|
||||
self.Q[s, a] += self.alpha * (td_target - self.Q[s, a])
|
||||
```
|
||||
|
||||
**선택 A를 써야 할 때:**
|
||||
- *(TODO)*
|
||||
### Distributional RL (C51)
|
||||
```python
|
||||
import torch
|
||||
import torch.nn as nn
|
||||
|
||||
**선택 B를 써야 할 때:**
|
||||
- *(TODO)*
|
||||
class C51(nn.Module):
|
||||
def __init__(self, n_actions, n_atoms=51, v_min=-10, v_max=10):
|
||||
super().__init__()
|
||||
self.n_atoms = n_atoms
|
||||
self.support = torch.linspace(v_min, v_max, n_atoms)
|
||||
self.delta_z = (v_max - v_min) / (n_atoms - 1)
|
||||
self.net = nn.Sequential(
|
||||
nn.Linear(state_dim, 128), nn.ReLU(),
|
||||
nn.Linear(128, n_actions * n_atoms),
|
||||
)
|
||||
|
||||
def forward(self, state):
|
||||
logits = self.net(state).view(-1, n_actions, self.n_atoms)
|
||||
probs = F.softmax(logits, dim=-1)
|
||||
return probs # 매 distribution per action
|
||||
|
||||
def q_values(self, state):
|
||||
probs = self(state)
|
||||
return (probs * self.support).sum(-1)
|
||||
```
|
||||
|
||||
**기본값:**
|
||||
> *(TODO)*
|
||||
### Eligibility trace (TD(λ))
|
||||
```python
|
||||
class TDLambda:
|
||||
def __init__(self, n_states, alpha=0.1, gamma=0.95, lam=0.9):
|
||||
self.V = np.zeros(n_states)
|
||||
self.e = np.zeros(n_states) # 매 eligibility trace
|
||||
self.alpha = alpha
|
||||
self.gamma = gamma
|
||||
self.lam = lam
|
||||
|
||||
def update(self, state, reward, next_state):
|
||||
td_error = reward + self.gamma * self.V[next_state] - self.V[state]
|
||||
self.e *= self.gamma * self.lam
|
||||
self.e[state] += 1
|
||||
self.V += self.alpha * td_error * self.e
|
||||
```
|
||||
|
||||
## ❌ 안티패턴 (Anti-Patterns)
|
||||
### Successor representation
|
||||
```python
|
||||
def learn_sr(transitions, n_states, alpha=0.05, gamma=0.95):
|
||||
"""매 SR(s, s') = expected discounted future visits to s'."""
|
||||
M = np.eye(n_states)
|
||||
|
||||
for s, s_next in transitions:
|
||||
I = np.eye(n_states)[s_next]
|
||||
M[s] += alpha * (I + gamma * M[s_next] - M[s])
|
||||
|
||||
return M
|
||||
|
||||
- **[안티패턴]:** *(TODO: 무엇을 하면 안 되는가 + 이유 + 대신 무엇을)*
|
||||
# 매 V(s) = 매 M(s, .) @ R
|
||||
```
|
||||
|
||||
### Brain-inspired Dreamer (model-based)
|
||||
```python
|
||||
class Dreamer:
|
||||
def __init__(self):
|
||||
self.world_model = WorldModel() # 매 prefrontal-like
|
||||
self.actor = Actor()
|
||||
self.critic = Critic()
|
||||
|
||||
def imagine(self, init_state, horizon=15):
|
||||
"""매 simulate trajectory in world model."""
|
||||
states, actions, rewards = [init_state], [], []
|
||||
for _ in range(horizon):
|
||||
a = self.actor(states[-1])
|
||||
s_next, r = self.world_model(states[-1], a)
|
||||
actions.append(a)
|
||||
rewards.append(r)
|
||||
states.append(s_next)
|
||||
return states, actions, rewards
|
||||
|
||||
def train(self, real_trajectories):
|
||||
# 매 1. world model 의 train (predict next + reward)
|
||||
self.world_model.train(real_trajectories)
|
||||
|
||||
# 매 2. actor + critic 의 imagined trajectory 의 train
|
||||
for _ in range(updates):
|
||||
init = random.choice(real_trajectories)[0]
|
||||
states, actions, rewards = self.imagine(init)
|
||||
self.critic.train(states, rewards)
|
||||
self.actor.train(states, self.critic)
|
||||
```
|
||||
|
||||
### Disease modeling (Parkinson's)
|
||||
```python
|
||||
def parkinson_simulation(td_learner, dopamine_deficit=0.5):
|
||||
"""매 dopamine deficit = 매 effective LR ↓."""
|
||||
td_learner.alpha *= (1 - dopamine_deficit)
|
||||
# 매 result: 매 slow learning, 매 reduced motivation.
|
||||
```
|
||||
|
||||
### RPE-based UI feedback (gamification done right)
|
||||
```python
|
||||
def calibrate_reward(expected, actual):
|
||||
"""매 user 의 expected vs actual 의 explicit feedback."""
|
||||
rpe = actual - expected
|
||||
if rpe > 0.3:
|
||||
return 'GREAT — exceeded expectations!'
|
||||
elif rpe < -0.3:
|
||||
return 'Try again — fell short.'
|
||||
return 'On track.'
|
||||
```
|
||||
|
||||
## 🤔 결정 기준
|
||||
| 응용 | Approach |
|
||||
|---|---|
|
||||
| Discrete env | Q-Learning / DQN |
|
||||
| Continuous | DDPG / SAC |
|
||||
| High-dim state | DQN / Rainbow |
|
||||
| Model-based | Dreamer / MuZero |
|
||||
| Risk-sensitive | Distributional RL |
|
||||
| Sparse reward | Curiosity / RND |
|
||||
| Few-shot | Meta-RL |
|
||||
| Brain disease modeling | RPE + lesion |
|
||||
|
||||
**기본값**: 매 PPO / SAC + 매 distributional / replay. 매 brain-inspired = Dreamer.
|
||||
|
||||
## 🔗 Graph
|
||||
- 부모: [[Reinforcement-Learning]] · [[Computational-Neuroscience]]
|
||||
- 변형: [[TD-Learning]] · [[Q-Learning]] · [[Distributional-RL]] · [[Meta-RL]] · [[Successor-Representation]]
|
||||
- 응용: [[Dreamer]] · [[MuZero]] · [[AlphaGo]] · [[Disease-Modeling]]
|
||||
- Adjacent: [[Bayesian-Brain-Hypothesis]] · [[Biological-Intelligence]] · [[Addiction-Neuroscience]] · [[Brain-Derived Neurotrophic Factor (BDNF)]]
|
||||
- Concept: [[Reward-Prediction-Error]] · [[Dopamine]] · [[Basal-Ganglia]]
|
||||
|
||||
## 🤖 LLM 활용
|
||||
**언제**: 매 RL algorithm design. 매 brain-inspired AI. 매 disease model. 매 reward schedule.
|
||||
**언제 X**: 매 supervised pure problem. 매 specific clinical decision (의사).
|
||||
|
||||
## ❌ 안티패턴
|
||||
- **Scalar reward 의 only**: 매 distributional 의 lose.
|
||||
- **No model (always free)**: 매 sample inefficient.
|
||||
- **TD-error 의 noise**: 매 unstable.
|
||||
- **Over-claim biological literal**: 매 metaphor 가 대부분.
|
||||
- **Disease cure expectation from model**: 매 simulation 의 limit.
|
||||
|
||||
## 🧪 검증 / 중복
|
||||
- Verified (Schultz dopamine, Sutton-Barto RL book, Dabney distributional, Hafner Dreamer).
|
||||
- 신뢰도 A.
|
||||
- Related: [[Bayesian-Brain-Hypothesis]] · [[Biological-Intelligence]] · [[Addiction-Neuroscience]] · [[Brain-Derived Neurotrophic Factor (BDNF)]] · [[Reinforcement-Learning]].
|
||||
|
||||
## 🕓 Changelog
|
||||
| 날짜 | 변경 |
|
||||
|---|---|
|
||||
| 2026-05-08 | Phase 1 |
|
||||
| 2026-05-10 | Manual cleanup — Schultz + TD + 매 distributional / SR / Dreamer code + disease |
|
||||
|
||||
Reference in New Issue
Block a user