f8b21af4be
10_Wiki/Topics 대규모 정리: - 오류 캡처/미완성 stub 문서 227개 제거 - 교차폴더 중복 43클러스터 병합 (63파일 → redirect) - 링크명 정규화: 깨진 링크 수정·redirect 직결·개념 매핑 ~2,400건 - 카테고리 MOC 6개 신규 생성 - Graph 섹션 미해결 related-keyword 링크 10,058건 제거 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
175 lines
5.7 KiB
Markdown
175 lines
5.7 KiB
Markdown
---
|
|
id: wiki-2026-0508-belief-system
|
|
title: Belief System
|
|
category: 10_Wiki/Topics
|
|
status: verified
|
|
canonical_id: self
|
|
aliases: [Belief System, Agent Belief, Knowledge Base, BDI Beliefs]
|
|
duplicate_of: none
|
|
source_trust_level: A
|
|
confidence_score: 0.85
|
|
verification_status: applied
|
|
tags: [agent-architecture, ai, bdi, knowledge-representation]
|
|
raw_sources: []
|
|
last_reinforced: 2026-05-10
|
|
github_commit: pending
|
|
tech_stack:
|
|
language: python
|
|
framework: bdi,langchain,owl-rdf
|
|
---
|
|
|
|
# Belief System
|
|
|
|
## 매 한 줄
|
|
> **"매 agent 의 'world 가 such-and-such' 의 internal model — 매 perception update · inference 로 부터 의 derive"**. Bratman 1987 BDI (Belief-Desire-Intention) 의 origin, 2026 의 LLM agent 의 working memory · scratchpad · long-term memory store 의 modern incarnation.
|
|
|
|
## 매 핵심
|
|
|
|
### 매 component
|
|
- **Belief base**: fact set (logical · probabilistic · embedding-vector).
|
|
- **Update rule**: perception → belief revision (AGM postulates).
|
|
- **Query interface**: 매 plan 의 condition 의 check.
|
|
- **Consistency check**: contradiction 의 detect · resolve.
|
|
|
|
### 매 representation
|
|
- **Symbolic**: Prolog · Datalog · OWL/RDF.
|
|
- **Probabilistic**: Bayesian network · Markov logic.
|
|
- **Vector/embedding**: 매 modern LLM agent — chunked text + embedding store.
|
|
- **Hybrid**: structured fact + free-text (most 2026 agent system).
|
|
|
|
### 매 응용
|
|
1. 매 BDI agent (JADE · Jadex · Jason).
|
|
2. Robot world model (ROS knowledge_base).
|
|
3. LLM agent scratchpad (Claude · LangGraph state).
|
|
|
|
## 💻 패턴
|
|
|
|
### BDI-style belief base (Python)
|
|
```python
|
|
from dataclasses import dataclass, field
|
|
from typing import Any
|
|
|
|
@dataclass
|
|
class BeliefBase:
|
|
facts: dict[str, Any] = field(default_factory=dict)
|
|
confidence: dict[str, float] = field(default_factory=dict)
|
|
|
|
def add(self, key: str, value: Any, conf: float = 1.0):
|
|
if key in self.facts and self.facts[key] != value:
|
|
# contradiction → keep higher-confidence
|
|
if conf <= self.confidence[key]: return
|
|
self.facts[key] = value
|
|
self.confidence[key] = conf
|
|
|
|
def query(self, key: str) -> tuple[Any, float] | None:
|
|
if key not in self.facts: return None
|
|
return self.facts[key], self.confidence[key]
|
|
|
|
bb = BeliefBase()
|
|
bb.add("door_open", True, 0.9)
|
|
bb.add("battery_pct", 73, 1.0)
|
|
```
|
|
|
|
### LLM agent: belief 의 prompt-injected scratchpad
|
|
```python
|
|
def build_prompt(beliefs: BeliefBase, task: str) -> str:
|
|
facts = "\n".join(
|
|
f"- {k}: {v} (conf={c:.2f})"
|
|
for k, (v, c) in [(k, (bb.facts[k], bb.confidence[k])) for k in bb.facts]
|
|
)
|
|
return f"""You are an agent with the following beliefs:
|
|
{facts}
|
|
|
|
Task: {task}
|
|
Plan your next action and explain reasoning."""
|
|
```
|
|
|
|
### Bayesian belief update (sensor fusion)
|
|
```python
|
|
def bayes_update(prior: float, likelihood: float, evidence: float) -> float:
|
|
"""P(H|E) = P(E|H) * P(H) / P(E)"""
|
|
return likelihood * prior / evidence
|
|
|
|
# Door 의 open 의 prior 0.5, sensor 의 reading "open" 의 likelihood 0.9, evidence 0.6
|
|
posterior = bayes_update(0.5, 0.9, 0.6) # 0.75
|
|
```
|
|
|
|
### Vector belief store (long-term memory)
|
|
```python
|
|
import chromadb
|
|
|
|
client = chromadb.PersistentClient("./agent_memory")
|
|
beliefs = client.get_or_create_collection("beliefs")
|
|
|
|
beliefs.upsert(
|
|
ids=["b-001"],
|
|
documents=["User prefers vegetarian restaurants in 5km radius"],
|
|
metadatas=[{"source": "user_pref_2026-04-12", "conf": 0.95}],
|
|
)
|
|
|
|
hits = beliefs.query(query_texts=["restaurant recommendation"], n_results=5)
|
|
```
|
|
|
|
### Belief revision (AGM contraction)
|
|
```python
|
|
def contract(bb: BeliefBase, fact: str):
|
|
"""Remove fact + minimal additional facts to restore consistency."""
|
|
if fact in bb.facts:
|
|
del bb.facts[fact]
|
|
del bb.confidence[fact]
|
|
# Naive — production uses entrenchment ordering
|
|
```
|
|
|
|
### LangGraph stateful belief
|
|
```python
|
|
from langgraph.graph import StateGraph
|
|
from typing import TypedDict
|
|
|
|
class AgentState(TypedDict):
|
|
beliefs: dict
|
|
desires: list[str]
|
|
intentions: list[str]
|
|
|
|
def perceive(state: AgentState) -> AgentState:
|
|
state["beliefs"]["weather"] = call_weather_api()
|
|
return state
|
|
|
|
graph = StateGraph(AgentState).add_node("perceive", perceive)
|
|
```
|
|
|
|
## 매 결정 기준
|
|
| 상황 | Representation |
|
|
|---|---|
|
|
| 매 deterministic rule-based | Datalog · Prolog |
|
|
| Uncertain sensor data | Bayesian network |
|
|
| Open-domain text · LLM agent | Vector embedding + scratchpad |
|
|
| Robot · spatial | Probabilistic occupancy grid + KB |
|
|
| Multi-agent · negotiation | KQML · FIPA + symbolic KB |
|
|
|
|
**기본값**: hybrid — symbolic skeleton (key fact 의 dict) + vector store (free-text long-term).
|
|
|
|
## 🔗 Graph
|
|
- 부모: [[Agent Architecture]] · [[Knowledge Representation]]
|
|
- 변형: [[Bayesian_Inference]]
|
|
- Adjacent: [[A2A]] · [[Belief Revision]]
|
|
|
|
## 🤖 LLM 활용
|
|
**언제**: belief base 의 natural-language form 의 store (e.g. user preference summary), scratchpad 의 reasoning step 의 record.
|
|
**언제 X**: 매 safety-critical inference (medical · industrial) — LLM 의 hallucinate · 매 symbolic verifiable 의 require.
|
|
|
|
## ❌ 안티패턴
|
|
- **No revision policy**: belief 의 add-only — contradictory state 의 accumulate.
|
|
- **Confidence 의 ignore**: 매 fact 의 binary present/absent — sensor noise 의 not handle.
|
|
- **Global belief blob**: 매 agent 의 share — privacy · ownership 의 unclear → BDI per-agent KB.
|
|
- **Vector-only memory**: 매 deterministic recall (e.g. "what is user's name") 의 unreliable — symbolic key/value 의 mix.
|
|
|
|
## 🧪 검증 / 중복
|
|
- Verified (Bratman 1987, AGM 1985, FIPA agent specs, LangGraph docs, ChromaDB docs).
|
|
- 신뢰도 A-.
|
|
|
|
## 🕓 Changelog
|
|
| 날짜 | 변경 |
|
|
|---|---|
|
|
| 2026-05-08 | Phase 1 |
|
|
| 2026-05-10 | Manual cleanup — BDI + 2026 LLM hybrid (vector + symbolic) |
|