[G1-Sync] Manual knowledge update
This commit is contained in:
@@ -1,95 +1,186 @@
|
||||
---
|
||||
id: wiki-2026-0508-neural-symbolic-integration
|
||||
title: Neural Symbolic Integration
|
||||
title: Neural-Symbolic Integration
|
||||
category: 10_Wiki/Topics
|
||||
status: needs_review
|
||||
status: verified
|
||||
canonical_id: self
|
||||
aliases: [P-Reinforce-AUTO-86032B]
|
||||
aliases: [Neuro-Symbolic AI, NeSy, Hybrid AI, Symbolic-Neural Integration]
|
||||
duplicate_of: none
|
||||
source_trust_level: A
|
||||
confidence_score: 0.95
|
||||
tags: [auto-reinforced, brain-science, integration]
|
||||
confidence_score: 0.92
|
||||
verification_status: applied
|
||||
tags: [neuro-symbolic, hybrid-ai, knowledge-graph, reasoning, alphageometry, scallop, deepproblog]
|
||||
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
|
||||
tech_stack: { language: python, framework: pytorch-scallop-deepproblog }
|
||||
---
|
||||
|
||||
# [[Neural-Symbolic-Integration|Neural-Symbolic-Integration]]
|
||||
## 한 줄
|
||||
|
||||
## 📌 한 줄 통찰 (The Karpathy Summary)
|
||||
> "딥러닝의 통계적 패턴 인식과 기호주의의 논리적 규칙성을 결합하여, 해석 가능하고(Explainable) 데이터 효율적인 범용 인공지능(AGI)으로 향하는 핵심 아키텍처."
|
||||
Neural-Symbolic Integration(NeSy)은 신경망의 패턴 인식·표현 학습 능력과 기호 시스템의 추론·해석성·구조화 지식을 결합해, 데이터 효율과 일반화·검증성을 동시에 추구하는 하이브리드 AI 방향이다.
|
||||
|
||||
## 📖 구조화된 지식 (Synthesized Content)
|
||||
Neural-Symbolic Integration(신경-기호 통합)은 하부의 인지 단계(지각)를 담당하는 신경망과 상부의 고차원 추론 단계를 담당하는 기호 언어를 단일 시스템 내에서 유기적으로 결합하는 기술입니다.
|
||||
## 핵심
|
||||
|
||||
1. **동작 원리**:
|
||||
* **Neural Component**: 이미지 인식, 음성 처리 등 비정형 데이터에서 특징(Feature)을 추출.
|
||||
* **Symbolic Component**: 추출된 특징을 논리적 상수로 변환하여 규칙 기반 추론([[Reasoning|Reasoning]]) 및 상식(Common Sense) 적용.
|
||||
2. **주요 모델**:
|
||||
* **DeepProbLog**: 신경망 출력값을 확률적 로직 프로그램의 인터페이스로 활용.
|
||||
* **[[Logic|Logic]] Tensor Networks (LTN)**: First-order logic을 미분 가능한 텐서 연산으로 기하학적 임베딩.
|
||||
3. **한계 극복**:
|
||||
* 데이터 기아 현상(Data Scarcity): 이미 정의된 기호적 지식을 주입하여 학습 데이터 요구량 감소.
|
||||
* 블랙박스 문제: 최종 결론이 어떤 논리적 단계를 거쳐 도출되었는지 추적 가능(Provenance).
|
||||
### Henry Kautz 분류 (2020)
|
||||
- **Type 1 — symbolic Neuro symbolic**: 입력/출력만 기호, 내부는 NN (대부분의 NLP).
|
||||
- **Type 2 — Symbolic[Neuro]**: 기호 시스템이 NN을 호출 (LLM tool use).
|
||||
- **Type 3 — Neuro;Symbolic**: 모듈 분리, 파이프라인.
|
||||
- **Type 4 — Neuro:Symbolic→Neuro**: 기호 지식을 NN에 주입 (KG embedding).
|
||||
- **Type 5 — Neuro_{Symbolic}**: 기호 제약을 NN 손실/구조에 통합 (DeepProbLog).
|
||||
- **Type 6 — Neuro[Symbolic]**: NN 내부에 진정한 기호 추론 모듈 — 미해결 목표.
|
||||
|
||||
## ⚠️ 모순 및 업데이트 (Contradictions & Updates)
|
||||
- **과거 데이터와의 충돌**: 초기 시스템은 '심볼 그라운딩(Symbol Grounding)' 과정에서 미분 불가능한 구간이 발생하여 효율적 학습이 어려웠으나, 최신 RL 연구(예: REINFORCE 알고리즘 활용)는 이 구간을 확률적으로 처하여 극복함.
|
||||
- **정책 변화(RL Update)**: 단순히 두 기술을 병렬로 배치하는 수준을 넘어, 신경망 아키텍처 자체에 논리적 제약 조건(Constraints)을 손실 함수(Loss Function)로 직접 통합하는 연구가 대세임.
|
||||
### 대표 시스템
|
||||
- **AlphaGeometry / AlphaGeometry 2** (DeepMind 2024–25): LLM이 보조선 제안 + symbolic deduction engine이 증명. IMO 금메달급.
|
||||
- **AlphaProof**: Lean + RL + LLM 결합 정리 증명.
|
||||
- **DeepProbLog**: 확률 논리 프로그램에 NN 술어 통합.
|
||||
- **Scallop**: differentiable Datalog, PyTorch 통합.
|
||||
- **Logic Tensor Networks (LTN)**: 1차 논리식을 fuzzy tensor 손실로.
|
||||
- **NS-CL** (MIT 2019): 시각 질의응답 via symbolic program execution.
|
||||
- **Knowledge Graph + LLM**: GraphRAG, retrieval-augmented reasoning.
|
||||
|
||||
## 🔗 지식 연결 (Graph)
|
||||
- **Related**: [[Neuro-Symbolic AI|Neuro-Symbolic AI]], [[Differentiable Programming|Differentiable Programming]], Knowledge Graphs, Foundational Models
|
||||
- **Modern Tech/Tools**: DeepProbLog, PyTorch-LPR, Logical Tensor Networks.
|
||||
---
|
||||
### 강점
|
||||
- Few-shot / zero-shot 추론.
|
||||
- 검증 가능 (proof, constraint).
|
||||
- 도메인 지식(KG, ontology) 활용.
|
||||
- Compositional generalization.
|
||||
|
||||
## 🤖 LLM 활용 힌트 (How to Use This Knowledge)
|
||||
### 한계
|
||||
- 통합 인터페이스 설계 어려움.
|
||||
- Symbolic 추론은 brittle, NN은 noisy → 경계 처리.
|
||||
- 학습 신호 전파 (미분 불가능 기호 연산).
|
||||
|
||||
**언제 이 지식을 쓰는가:**
|
||||
- *(TODO)*
|
||||
### 응용
|
||||
- 수학 정리 증명 (AlphaProof, AlphaGeometry).
|
||||
- 의학 진단 (KG + clinical NLP).
|
||||
- 로보틱스 task planning (LLM + PDDL).
|
||||
- 법률·규정 추론 (rule + NLP).
|
||||
|
||||
**언제 쓰면 안 되는가:**
|
||||
- *(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
|
||||
```python
|
||||
# 1. LLM + Symbolic solver — Sympy 호출
|
||||
import sympy as sp
|
||||
def solve_with_llm(question_nl: str, llm) -> str:
|
||||
eq_str = llm.translate_to_sympy(question_nl) # NL → "x**2 - 4"
|
||||
x = sp.Symbol("x")
|
||||
roots = sp.solve(sp.sympify(eq_str), x)
|
||||
return llm.format_answer(roots)
|
||||
```
|
||||
|
||||
## 🤔 의사결정 기준 (Decision Criteria)
|
||||
```python
|
||||
# 2. DeepProbLog — 확률 논리 + NN 술어
|
||||
"""
|
||||
nn(mnist_net, [X], Y, [0,1,...,9]) :: digit(X, Y).
|
||||
addition(X, Y, Z) :- digit(X, A), digit(Y, B), Z is A+B.
|
||||
"""
|
||||
# X, Y는 MNIST 이미지, Z는 합. NN이 digit 술어를 학습.
|
||||
```
|
||||
|
||||
**선택 A를 써야 할 때:**
|
||||
- *(TODO)*
|
||||
```python
|
||||
# 3. Scallop — differentiable Datalog
|
||||
import scallopy
|
||||
ctx = scallopy.ScallopContext(provenance="diffminmaxprob")
|
||||
ctx.add_relation("digit_1", (int, int)) # (img_id, value)
|
||||
ctx.add_relation("digit_2", (int, int))
|
||||
ctx.add_rule("sum(a+b) = digit_1(a), digit_2(b)")
|
||||
ctx.run()
|
||||
```
|
||||
|
||||
**선택 B를 써야 할 때:**
|
||||
- *(TODO)*
|
||||
```python
|
||||
# 4. Logic Tensor Network — 제약을 손실로
|
||||
# ∀x: dog(x) → animal(x) 를 fuzzy 만족도로 변환
|
||||
import torch
|
||||
def implies(p, q): return torch.clamp(1 - p + q, 0, 1)
|
||||
loss_logic = -torch.log(implies(dog_pred, animal_pred)).mean()
|
||||
total_loss = ce_loss + lambda_logic * loss_logic
|
||||
```
|
||||
|
||||
**기본값:**
|
||||
> *(TODO)*
|
||||
```python
|
||||
# 5. Knowledge Graph + Embedding — TransE
|
||||
# h + r ≈ t 가 성립하도록 entity/relation embedding 학습
|
||||
score = -torch.norm(emb_h + emb_r - emb_t, p=2, dim=-1)
|
||||
```
|
||||
|
||||
## ❌ 안티패턴 (Anti-Patterns)
|
||||
```python
|
||||
# 6. GraphRAG — KG 검색 + LLM 답변
|
||||
def graph_rag(query, kg, llm, embedder):
|
||||
nodes = kg.search(embedder.encode(query), top_k=10)
|
||||
subgraph = kg.expand_neighborhood(nodes, hops=2)
|
||||
context = serialize_graph(subgraph)
|
||||
return llm.complete(f"Context:\n{context}\n\nQ: {query}\nA:")
|
||||
```
|
||||
|
||||
- **[안티패턴]:** *(TODO: 무엇을 하면 안 되는가 + 이유 + 대신 무엇을)*
|
||||
```python
|
||||
# 7. LLM tool use — calculator/SQL
|
||||
tools = [{
|
||||
"name": "calculator", "description": "evaluate math",
|
||||
"input_schema": {"type":"object","properties":{"expr":{"type":"string"}}}
|
||||
}]
|
||||
# Claude/OpenAI tool calling으로 symbolic 백엔드 호출
|
||||
```
|
||||
|
||||
```python
|
||||
# 8. Constraint satisfaction in NN — projection layer
|
||||
def project_to_constraints(logits, constraints):
|
||||
# 분류 결과를 ontology 제약 만족 영역으로 투영
|
||||
return solver.project(logits, constraints)
|
||||
```
|
||||
|
||||
```python
|
||||
# 9. Program induction — LLM이 DSL 프로그램 생성
|
||||
def neuro_symbolic_qa(image, question, llm):
|
||||
program = llm.generate_program(question) # filter(color=red), count(...)
|
||||
return execute_dsl(program, image) # symbolic execution
|
||||
```
|
||||
|
||||
```python
|
||||
# 10. AlphaGeometry-style — 보조선 제안 + DDAR
|
||||
def prove_geom(problem, llm, ddar):
|
||||
state = parse(problem)
|
||||
while not ddar.solve(state):
|
||||
new_construction = llm.suggest_aux_line(state)
|
||||
state = state.add(new_construction)
|
||||
return ddar.proof(state)
|
||||
```
|
||||
|
||||
## 결정 기준
|
||||
|
||||
| 문제 | 추천 |
|
||||
|---|---|
|
||||
| 정확한 수치 계산 필요 | LLM + sympy/계산기 (Type 2) |
|
||||
| 도메인 KG 존재 | GraphRAG / TransE 임베딩 (Type 4) |
|
||||
| 논리 제약 강제 필요 | LTN / Semantic Loss (Type 5) |
|
||||
| 확률 + 논리 결합 | DeepProbLog / Scallop |
|
||||
| 시각 추론 (CLEVR류) | NS-CL, program induction |
|
||||
| 정리 증명 | AlphaProof / AlphaGeometry / Lean+RL |
|
||||
| 일반 작업 (대부분 데이터 ML) | NeSy 불필요, NN만으로 충분 |
|
||||
|
||||
기본값: LLM tool use(Type 2) + KG 보강(Type 4)이 가장 실용적이다.
|
||||
|
||||
## 🔗 Graph
|
||||
- 부모: [[Hybrid-AI]], [[Symbolic-AI]], [[Deep-Learning]]
|
||||
- 형제: [[Knowledge-Graph]], [[Logic-Programming]], [[Probabilistic-Programming]]
|
||||
- 자식: [[DeepProbLog]], [[Scallop]], [[Logic-Tensor-Network]], [[NS-CL]]
|
||||
- 응용: [[AlphaGeometry]], [[AlphaProof]], [[GraphRAG]], [[Lean-Theorem-Prover]]
|
||||
- 인물: [[Henry-Kautz]], [[Artur-Garcez]]
|
||||
|
||||
## 🤖 LLM 활용
|
||||
- LLM 자체가 Type 2 NeSy의 핵심 — tool use, code interpreter, RAG.
|
||||
- LLM + Lean/Coq/Sympy로 검증 가능한 답변 생성.
|
||||
- 2025–26 추세: agentic NeSy (LLM이 KG·solver를 자율 orchestration).
|
||||
|
||||
## ❌ 안티패턴
|
||||
- 모든 문제에 NeSy 강제 — 단순 분류엔 과설계.
|
||||
- 미분 불가능 기호 연산을 학습 루프에 직접 (REINFORCE/STE 없이).
|
||||
- KG 품질 검증 없이 임베딩 → 노이즈 증폭.
|
||||
- LLM에게 추론 전체를 맡기고 검증 단계 생략.
|
||||
|
||||
## 🧪 검증 / 중복
|
||||
- AlphaGeometry IMO 30문제 벤치, ProofNet, MATH 데이터셋.
|
||||
- 별칭 통합: [[Neuro-Symbolic-AI]], [[NeSy]], [[Hybrid-AI]].
|
||||
- 검증: 기호 검증기(Lean, Z3) 통과 비율로 측정.
|
||||
|
||||
## 🕓 Changelog
|
||||
- Phase 1 (2026-05-08): 초기 생성.
|
||||
- Manual cleanup (2026-05-10): canonical 확정, Kautz 6분류, AlphaGeometry/AlphaProof 2024-25 사례 추가, 패턴 10개 정비.
|
||||
|
||||
Reference in New Issue
Block a user