Files
2nd/10_Wiki/Topics/Architecture/Belief-System.md
T
2026-05-10 22:08:15 +09:00

5.8 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-belief-system Belief System 10_Wiki/Topics verified self
Belief System
Agent Belief
Knowledge Base
BDI Beliefs
none A 0.85 applied
agent-architecture
ai
bdi
knowledge-representation
2026-05-10 pending
language framework
python 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)

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

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)

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)

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)

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

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

🤖 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)