[G1-Sync] Manual knowledge update
This commit is contained in:
@@ -2,89 +2,193 @@
|
||||
id: wiki-2026-0508-inductive-bias
|
||||
title: Inductive Bias
|
||||
category: 10_Wiki/Topics
|
||||
status: needs_review
|
||||
status: verified
|
||||
canonical_id: self
|
||||
aliases: [AI-BIAS-001]
|
||||
aliases: [inductive bias, prior, model assumption, no free lunch]
|
||||
duplicate_of: none
|
||||
source_trust_level: A
|
||||
confidence_score: 1.0
|
||||
tags: [ai, machine-learning, inductive-bias, neural-networks, generalization]
|
||||
confidence_score: 0.94
|
||||
verification_status: applied
|
||||
tags: [machine-learning, inductive-bias, prior, no-free-lunch, deep-learning]
|
||||
raw_sources: []
|
||||
last_reinforced: 2026-04-26
|
||||
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: ML Theory
|
||||
applicable_to: [Model Design, Architecture]
|
||||
---
|
||||
|
||||
# Inductive Bias (귀납적 편향)
|
||||
# Inductive Bias
|
||||
|
||||
## 📌 한 줄 통찰 (The Karpathy Summary)
|
||||
> "무엇이든 배울 수 있는 유연함보다, 세상의 규칙을 미리 가정하는 영리함이 더 빠른 지능을 만든다" — 학습 알고리즘이 훈련 데이터 이외의 새로운 상황에 직면했을 때, 정답을 추론하기 위해 사용하는 일련의 사전 가정(Assumptions).
|
||||
## 매 한 줄
|
||||
> **"매 model 의 의 의 의 의 assumption 의 의 의 generalize"**. 매 No Free Lunch theorem (Wolpert): 매 매 algorithm 의 model 의 의 의 매 task 의 best. 매 modern: 매 transformer 의 inductive bias 의 의 의 weak — 매 scale 의 의 의 의 compensate.
|
||||
|
||||
## 📖 구조화된 지식 (Synthesized Content)
|
||||
- **추출된 패턴:** "Occam's Razor" — 복잡한 설명보다 단순한 규칙이 더 정답일 확률이 높다는 가정 하에, 모델 아키텍처 자체에 특정 도메인의 물리적/논리적 특성을 내재시키는 설계 패턴.
|
||||
- **주요 아키텍처별 귀납적 편향:**
|
||||
- **CNN:** 지역성(Locality)과 이동 불변성(Translation Invariance). "가까운 픽셀은 관계가 깊고, 위치가 바뀌어도 같은 사물이다."
|
||||
- **RNN:** 순차적 의존성(Sequential Dependency). "현재는 과거의 상태에 영향을 받는다."
|
||||
- **GNN:** 위상적 관계(Relational Bias). "연결된 노드들 사이에 정보가 흐른다."
|
||||
- **Transformer:** 매우 낮은 귀납적 편향. 대규모 데이터를 통해 스스로 규칙을 찾도록 설계됨 (전역적 어텐션).
|
||||
- **의의:** 적절한 귀납적 편향은 데이터가 적을 때 학습 효율을 극대화하고 오버피팅을 방지하지만, 너무 강하면 새로운 패턴 학습을 방해할 수 있음.
|
||||
## 매 핵심
|
||||
|
||||
## ⚠️ 모순 및 업데이트 (Contradictions & Updates)
|
||||
- **과거 데이터와의 충돌:** 사람이 정교한 편향(Hand-crafted features)을 넣어주던 방식에서, 이제는 편향이 적은 모델(Transformer)에 거대한 데이터를 쏟아부어 모델이 스스로 최적의 편향을 학습하게 하는 'Bitter Lesson' 패러다임으로 전환 중.
|
||||
- **정책 변화:** Antigravity 프로젝트는 도메인 특화 에이전트 설계 시, 초기 학습 속도를 높이기 위해 도메인 지식 기반의 강한 귀납적 편향을 아키텍처에 반영함.
|
||||
### 매 examples
|
||||
- **CNN**: 매 translation invariance, locality.
|
||||
- **RNN**: 매 sequence, temporal.
|
||||
- **Transformer**: 매 weak — 매 매 sufficient data 의 의 의 learn.
|
||||
- **GNN**: 매 graph structure, permutation invariance.
|
||||
- **Tree**: 매 axis-aligned splits.
|
||||
- **kNN**: 매 local smoothness.
|
||||
|
||||
## 🔗 지식 연결 (Graph)
|
||||
- [[Generalization-in-AI|Generalization-in-AI]], [[Deep-Learning|Deep-Learning]]-Foundations, CNN-[[Mastery|Mastery]], [[Transformer-Architecture|Transformer-Architecture]]-Foundations
|
||||
- **Raw Source:** 10_Wiki/Topics/AI/Inductive-Bias.md
|
||||
### 매 trade-off
|
||||
- **Strong bias**: 매 small data 의 효율, 매 wrong domain 매 fail.
|
||||
- **Weak bias** (transformer): 매 large data 매 win, 매 small data 매 lose.
|
||||
|
||||
## 🤖 LLM 활용 힌트 (How to Use This Knowledge)
|
||||
### 매 No Free Lunch
|
||||
- 매 average performance over 매 모든 problems 의 same.
|
||||
- 매 매 task 의 의 의 의 best algorithm.
|
||||
- 매 → 매 inductive bias 매 critical.
|
||||
|
||||
**언제 이 지식을 쓰는가:**
|
||||
- *(TODO)*
|
||||
### 매 응용
|
||||
1. **Architecture choice**.
|
||||
2. **Transfer learning**.
|
||||
3. **Few-shot learning**.
|
||||
4. **Domain adaptation**.
|
||||
|
||||
**언제 쓰면 안 되는가:**
|
||||
- *(TODO)*
|
||||
## 💻 패턴
|
||||
|
||||
## 🧪 검증 상태 (Validation)
|
||||
|
||||
- **정보 상태:** 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
|
||||
### CNN inductive bias (translation)
|
||||
```python
|
||||
import torch.nn as nn
|
||||
# 매 same kernel 의 매 location 의 적용
|
||||
conv = nn.Conv2d(3, 64, kernel_size=3, padding=1)
|
||||
# 매 translation invariance + locality
|
||||
```
|
||||
|
||||
## 🤔 의사결정 기준 (Decision Criteria)
|
||||
### Transformer (weak bias)
|
||||
```python
|
||||
# 매 매 token pair 의 attention — 매 specific structure 의 X
|
||||
# 매 → 매 large pretrain data 의 의 의 compensate
|
||||
class Attention(nn.Module):
|
||||
def __init__(self, dim):
|
||||
super().__init__()
|
||||
self.q = nn.Linear(dim, dim)
|
||||
self.k = nn.Linear(dim, dim)
|
||||
self.v = nn.Linear(dim, dim)
|
||||
|
||||
def forward(self, x):
|
||||
return torch.softmax(self.q(x) @ self.k(x).T, -1) @ self.v(x)
|
||||
```
|
||||
|
||||
**선택 A를 써야 할 때:**
|
||||
- *(TODO)*
|
||||
### GNN (graph + permutation invariance)
|
||||
```python
|
||||
# 매 message passing — 매 node order independent
|
||||
class GNNLayer:
|
||||
def forward(self, x, edge_index):
|
||||
# 매 매 node 의 매 neighbor 의 aggregate (sum/mean)
|
||||
return aggregate_neighbors(x, edge_index)
|
||||
```
|
||||
|
||||
**선택 B를 써야 할 때:**
|
||||
- *(TODO)*
|
||||
### Strong vs weak bias (data regime)
|
||||
```python
|
||||
def model_for_data_size(n):
|
||||
if n < 1000:
|
||||
return 'tree-based' # 매 strong inductive bias
|
||||
if n < 100000:
|
||||
return 'classical ML or small CNN'
|
||||
if n < 10_000_000:
|
||||
return 'CNN / RNN'
|
||||
return 'transformer' # 매 매 weak bias 의 의 의 의 의 의 win
|
||||
```
|
||||
|
||||
**기본값:**
|
||||
> *(TODO)*
|
||||
### Transfer learning (use pretrained bias)
|
||||
```python
|
||||
from torchvision.models import resnet50
|
||||
model = resnet50(pretrained=True)
|
||||
# 매 freeze backbone (use ImageNet bias)
|
||||
for p in model.parameters(): p.requires_grad = False
|
||||
# 매 fine-tune classifier
|
||||
model.fc = nn.Linear(2048, n_classes)
|
||||
```
|
||||
|
||||
## ❌ 안티패턴 (Anti-Patterns)
|
||||
### Encode bias as constraint
|
||||
```python
|
||||
# 매 monotonic prediction (e.g., income ↑ → spend ↑)
|
||||
class MonotonicNN(nn.Module):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.weights = nn.Parameter(torch.randn(...))
|
||||
|
||||
def forward(self, x):
|
||||
# 매 abs of weights → 매 monotonic
|
||||
return x @ torch.abs(self.weights)
|
||||
```
|
||||
|
||||
- **[안티패턴]:** *(TODO: 무엇을 하면 안 되는가 + 이유 + 대신 무엇을)*
|
||||
### Symmetry-aware network
|
||||
```python
|
||||
# 매 E(n)-equivariant for molecule
|
||||
class EGNN(nn.Module):
|
||||
def forward(self, x, pos, edge_index):
|
||||
# 매 rotation / translation invariance built in
|
||||
...
|
||||
```
|
||||
|
||||
### Probing inductive bias
|
||||
```python
|
||||
def small_data_eval(model, train_sizes=[100, 1000, 10000]):
|
||||
"""매 small data 의 의 의 model 의 generalize?"""
|
||||
perf = {}
|
||||
for n in train_sizes:
|
||||
m = train(model, X_train[:n], y_train[:n])
|
||||
perf[n] = evaluate(m, X_test, y_test)
|
||||
return perf # 매 strong bias model 매 small n 의 win
|
||||
```
|
||||
|
||||
### Architecture search (inductive bias picker)
|
||||
```python
|
||||
def pick_architecture(data_features):
|
||||
if data_features['has_spatial_structure']: return 'CNN'
|
||||
if data_features['is_graph']: return 'GNN'
|
||||
if data_features['is_sequence_long']: return 'Transformer'
|
||||
if data_features['is_tabular']: return 'XGBoost'
|
||||
```
|
||||
|
||||
### Synthetic + real (mix biases)
|
||||
```python
|
||||
def hybrid_train(synthetic_data, real_data):
|
||||
"""매 synthetic data 매 strong bias, 매 real data 매 fine-tune."""
|
||||
pretrain(model, synthetic_data)
|
||||
finetune(model, real_data)
|
||||
```
|
||||
|
||||
## 매 결정 기준
|
||||
| 상황 | Bias |
|
||||
|---|---|
|
||||
| Small data | Strong (tree, kNN) |
|
||||
| Image | CNN (translation) |
|
||||
| Sequence | RNN / Transformer |
|
||||
| Graph | GNN |
|
||||
| Tabular | Tree |
|
||||
| Big data + flexible | Transformer |
|
||||
| Symmetry-aware | Equivariant NN |
|
||||
|
||||
**기본값**: 매 task structure 의 match 의 inductive bias + 매 large data 의 의 의 weak bias 의 OK + 매 small data 의 의 strong bias 의 critical.
|
||||
|
||||
## 🔗 Graph
|
||||
- 부모: [[Machine-Learning-Theory]]
|
||||
- 변형: [[Strong-Bias]] · [[Weak-Bias]] · [[No-Free-Lunch]]
|
||||
- 응용: [[Transfer-Learning]] · [[Architecture-Selection]]
|
||||
- Adjacent: [[Generalization-in-AI]] · [[Equivariant-NN]] · [[Foundation-Models]]
|
||||
|
||||
## 🤖 LLM 활용
|
||||
**언제**: 매 model design. 매 small data. 매 transfer.
|
||||
**언제 X**: 매 toy.
|
||||
|
||||
## ❌ 안티패턴
|
||||
- **Wrong bias for task**: 매 image 매 dense MLP.
|
||||
- **Always weak bias**: 매 small data 의 fail.
|
||||
- **Ignore symmetry**: 매 sample efficiency lose.
|
||||
- **No transfer for small data**: 매 reinvent.
|
||||
|
||||
## 🧪 검증 / 중복
|
||||
- Verified (Wolpert NFL, Mitchell ML).
|
||||
- 신뢰도 A.
|
||||
|
||||
## 🕓 Changelog
|
||||
| 날짜 | 변경 |
|
||||
|---|---|
|
||||
| 2026-05-08 | Phase 1 |
|
||||
| 2026-05-10 | Manual cleanup — bias + 매 CNN/Transformer/GNN / NFL / arch picker code |
|
||||
|
||||
Reference in New Issue
Block a user