d8a80f6272
이름만 다른(표기 변형) [[위키링크]]를 대상 문서의 canonical 제목으로 치환해 끊겼던 1,200개 링크를 연결. 제목/파일명 정규화 일치만 적용하고 별칭 매칭은 과병합 위험으로 제외(애매성 가드). 원본은 _link_reconcile_backup/ 에 백업. 도구: Datacollect/scripts/link_reconcile_apply.mjs Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
6.5 KiB
6.5 KiB
id, title, category, status, canonical_id, aliases, duplicate_of, source_trust_level, confidence_score, verification_status, tags, raw_sources, last_reinforced, github_commit, tech_stack
| id | title | category | status | canonical_id | aliases | duplicate_of | source_trust_level | confidence_score | verification_status | tags | raw_sources | last_reinforced | github_commit | tech_stack | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| wiki-2026-0508-exploration-vs-exploitation | Exploration vs Exploitation | 10_Wiki/Topics | verified | self |
|
none | A | 0.9 | applied |
|
2026-05-10 | pending |
|
Exploration vs Exploitation
매 한 줄
"매 known-best 의 exploit 의 unknown 의 explore 의 fundamental tradeoff". Exploration-exploitation dilemma 매 RL · bandits · A/B testing 의 core — 매 current best action 의 only 의 take 시 매 better unknown 의 miss, 매 too much explore 시 매 reward 의 burn. Optimal balance 매 horizon, prior, regret budget 의 function.
매 핵심
매 Spectrum
- Pure exploit (greedy): 매 always 매 argmax Q(a) — 매 local optimum trap.
- Pure explore (random): 매 always uniform — 매 expected regret O(T).
- ε-greedy: 매 prob ε 매 explore, 매 prob 1−ε 매 exploit.
- UCB: 매 confidence-bounded 매 deterministic explore.
- Thompson Sampling: 매 posterior sampling 매 Bayesian optimal.
매 Regret bounds
- 매 ε-greedy(static): O(T).
- 매 ε-greedy(decaying 1/t): O(log T).
- 매 UCB1: O(log T) — provably tight for stochastic bandit.
- 매 Thompson Sampling: matches Lai-Robbins lower bound.
매 응용
- A/B/n testing — adaptive traffic allocation.
- Recommender systems — cold start.
- Hyperparameter tuning (Optuna, Vizier).
- RL games — Atari, AlphaGo MCTS.
- LLM 매 sampling temperature, top-p.
- Drug trials — bandit-style adaptive design.
💻 패턴
ε-greedy bandit
import numpy as np
class EpsilonGreedy:
def __init__(self, k, eps=0.1):
self.k = k
self.eps = eps
self.Q = np.zeros(k)
self.N = np.zeros(k)
def select(self):
if np.random.rand() < self.eps:
return np.random.randint(self.k)
return int(np.argmax(self.Q))
def update(self, a, r):
self.N[a] += 1
self.Q[a] += (r - self.Q[a]) / self.N[a]
UCB1
class UCB1:
def __init__(self, k):
self.k, self.t = k, 0
self.Q = np.zeros(k)
self.N = np.zeros(k)
def select(self):
self.t += 1
for a in range(self.k):
if self.N[a] == 0:
return a # cold-start each arm once
ucb = self.Q + np.sqrt(2 * np.log(self.t) / self.N)
return int(np.argmax(ucb))
def update(self, a, r):
self.N[a] += 1
self.Q[a] += (r - self.Q[a]) / self.N[a]
Thompson Sampling (Bernoulli)
class ThompsonBernoulli:
def __init__(self, k):
self.alpha = np.ones(k) # successes + 1
self.beta = np.ones(k) # failures + 1
def select(self):
samples = np.random.beta(self.alpha, self.beta)
return int(np.argmax(samples))
def update(self, a, r):
if r > 0: self.alpha[a] += 1
else: self.beta[a] += 1
Decaying ε schedule
def epsilon(t, start=1.0, end=0.05, decay=10000):
return end + (start - end) * np.exp(-t / decay)
# DQN-style: 매 early episodes 의 explore-heavy, 매 late 의 exploit
Boltzmann (softmax) exploration
def softmax_select(Q, tau=1.0):
p = np.exp(Q / tau)
p /= p.sum()
return np.random.choice(len(Q), p=p)
# tau→0 매 greedy, tau→∞ 매 uniform
Contextual bandit (LinUCB)
class LinUCB:
def __init__(self, k, d, alpha=1.0):
self.A = [np.eye(d) for _ in range(k)]
self.b = [np.zeros(d) for _ in range(k)]
self.alpha = alpha
def select(self, x): # context vector
ucb = []
for a in range(len(self.A)):
Ainv = np.linalg.inv(self.A[a])
theta = Ainv @ self.b[a]
mean = theta @ x
bonus = self.alpha * np.sqrt(x @ Ainv @ x)
ucb.append(mean + bonus)
return int(np.argmax(ucb))
def update(self, a, x, r):
self.A[a] += np.outer(x, x)
self.b[a] += r * x
LLM sampling 의 explore-exploit
# temperature=0 → exploit (deterministic argmax)
# temperature=1 → explore (full distribution)
# top-p=0.9 → constrained explore (nucleus)
def sample_token(logits, temperature=0.7, top_p=0.9):
logits = logits / temperature
probs = softmax(logits)
sorted_idx = np.argsort(probs)[::-1]
cum = np.cumsum(probs[sorted_idx])
cutoff = np.searchsorted(cum, top_p) + 1
keep = sorted_idx[:cutoff]
p = probs[keep] / probs[keep].sum()
return np.random.choice(keep, p=p)
매 결정 기준
| 상황 | Approach |
|---|---|
| Stationary stochastic bandit | 매 UCB1 또는 Thompson |
| Bernoulli reward | 매 Thompson Beta-binomial |
| Contextual features 의 available | 매 LinUCB / NeuralBandit |
| Non-stationary (drift) | 매 sliding-window UCB / discounted TS |
| Deep RL | 매 ε-greedy decay 또는 noisy nets |
| LLM creative generation | 매 temperature 0.7-1.0 + top-p 0.9 |
기본값: 매 Thompson Sampling — 매 strong empirical 의 winner, 매 simple implementation.
🔗 Graph
- 부모: Reinforcement-Learning · Decision Theory
- 변형: Multi-Armed-Bandit
- 응용: Recommender-Systems · Hyperparameters · MCTS
- Adjacent: Bayesian-Optimization · Active Learning · LLM-Sampling
🤖 LLM 활용
언제: 매 sequential decision 매 reward feedback. Cold-start recommender. A/B 의 multi-arm 의 generalize. 언제 X: 매 known reward distribution + horizon→∞ — 매 closed-form optimal. Single-shot decision.
어려운 점 (안티패턴)
- Static ε too high: 매 ε=0.5 forever — 매 final 50% traffic 의 random arm 의 burn. Decay 의 use.
- No cold-start arms: 매 UCB 의 N[a]=0 의 not-handled — 매 inf 의 produce, 매 each arm 의 1 초기 pull 의 require.
- Non-stationarity ignored: 매 reward drift 의 discount 없이 의 stale Q value 의 trust.
- Reward leakage: 매 future info 매 leak — 매 fake "exploit" 매 actually 의 cheat.
🧪 검증 / 중복
- Verified (Sutton & Barto Ch. 2; Lai-Robbins 1985; Russo et al. "Tutorial on Thompson Sampling" 2018).
- 신뢰도 A.
🕓 Changelog
| 날짜 | 변경 |
|---|---|
| 2026-05-08 | Phase 1 |
| 2026-05-10 | Manual cleanup — explore-exploit + 7 algorithm patterns |