Files
2nd/10_Wiki/Topics/AI_and_ML/Neural-Symbolic-Integration.md
T
koriweb d8a80f6272 chore(wiki): dangling 링크 canonical 정규화 (768파일/1200건)
이름만 다른(표기 변형) [[위키링크]]를 대상 문서의 canonical 제목으로 치환해
끊겼던 1,200개 링크를 연결. 제목/파일명 정규화 일치만 적용하고 별칭 매칭은
과병합 위험으로 제외(애매성 가드). 원본은 _link_reconcile_backup/ 에 백업.
도구: Datacollect/scripts/link_reconcile_apply.mjs

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-08 12:24:15 +09:00

6.7 KiB
Raw Blame History

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-neural-symbolic-integration Neural-Symbolic Integration 10_Wiki/Topics verified self
Neuro-Symbolic AI
NeSy
Hybrid AI
Symbolic-Neural Integration
none A 0.92 applied
neuro-symbolic
hybrid-ai
knowledge-graph
reasoning
alphageometry
scallop
deepproblog
2026-05-10 pending
language framework
python pytorch-scallop-deepproblog

한 줄

Neural-Symbolic Integration(NeSy)은 신경망의 패턴 인식·표현 학습 능력과 기호 시스템의 추론·해석성·구조화 지식을 결합해, 데이터 효율과 일반화·검증성을 동시에 추구하는 하이브리드 AI 방향이다.

핵심

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 내부에 진정한 기호 추론 모듈 — 미해결 목표.

대표 시스템

  • AlphaGeometry / AlphaGeometry 2 (DeepMind 202425): 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.

강점

  • Few-shot / zero-shot 추론.
  • 검증 가능 (proof, constraint).
  • 도메인 지식(KG, ontology) 활용.
  • Compositional generalization.

한계

  • 통합 인터페이스 설계 어려움.
  • Symbolic 추론은 brittle, NN은 noisy → 경계 처리.
  • 학습 신호 전파 (미분 불가능 기호 연산).

응용

  • 수학 정리 증명 (AlphaProof, AlphaGeometry).
  • 의학 진단 (KG + clinical NLP).
  • 로보틱스 task planning (LLM + PDDL).
  • 법률·규정 추론 (rule + NLP).

💻 패턴

# 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)
# 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 술어를 학습.
# 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()
# 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
# 5. Knowledge Graph + Embedding — TransE
# h + r ≈ t 가 성립하도록 entity/relation embedding 학습
score = -torch.norm(emb_h + emb_r - emb_t, p=2, dim=-1)
# 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:")
# 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 백엔드 호출
# 8. Constraint satisfaction in NN — projection layer
def project_to_constraints(logits, constraints):
    # 분류 결과를 ontology 제약 만족 영역으로 투영
    return solver.project(logits, constraints)
# 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
# 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

🤖 LLM 활용

  • LLM 자체가 Type 2 NeSy의 핵심 — tool use, code interpreter, RAG.
  • LLM + Lean/Coq/Sympy로 검증 가능한 답변 생성.
  • 202526 추세: agentic NeSy (LLM이 KG·solver를 자율 orchestration).

안티패턴

  • 모든 문제에 NeSy 강제 — 단순 분류엔 과설계.
  • 미분 불가능 기호 연산을 학습 루프에 직접 (REINFORCE/STE 없이).
  • KG 품질 검증 없이 임베딩 → 노이즈 증폭.
  • LLM에게 추론 전체를 맡기고 검증 단계 생략.

🧪 검증 / 중복

🕓 Changelog

  • Phase 1 (2026-05-08): 초기 생성.
  • Manual cleanup (2026-05-10): canonical 확정, Kautz 6분류, AlphaGeometry/AlphaProof 2024-25 사례 추가, 패턴 10개 정비.