docs(10_Wiki): 위키 전체 재구성 — Topic_* 폴더를 4개 카테고리로 통합 + 대규모 중복 제거
Topic_Agent/Topic_Blog/Topics/Topics_Biz/Topics_Meeting/Topics_Rag의 마크다운 지식 문서를 Topic_General/Topic_Programming/Topic_Graphic/Topic_Business 4개 카테고리로 재분류. - 중복 제거: frontmatter의 status:duplicate/merged + duplicate_of/redirect_to 필드로 자기 자신을 중복으로 선언한 리다이렉트 stub 1032개 제거, 완전 동일 내용 파일 472개 제거, 동일 파일명·다른 내용 충돌 시 더 큰(완전한) 버전만 유지(162개 제거) — 총 1639개 중복 제거. - 분류: 폴더 단위로 명확한 항목(AI_and_ML/Coding/Architecture 등 → Programming, Comfyui/Visual_Effects → Graphic, Topics_Biz/Topics_Meeting/사업 등 → Business, Poetic_Blog_Writing/창의성/Game_Design 등 → General)은 폴더 우선순위로, 나머지 혼재 폴더(Topic_Agent/Topic_Blog/Topics 루트/Thinking & Reasoning/Other/UI_UX_Assets)는 title/tags 키워드 스코어링으로 파일 단위 분류(불명확한 경우 General로 폴백). 원본 폴더명은 "From_*" 서브폴더로 보존해 추적 가능성 유지. - 최종 배치: Programming 2784 / General 1608 / Graphic 285 / Business 249 = 4926개 문서. - 에이전트 운영 상태(.astra/.agent/.obsidian/sessions/memory/_company/docs/lessons/_shared/src)는 지식 콘텐츠가 아니므로 재분류 대상에서 제외하고 원위치 유지. - Topics/Topic_email(상위 보호 폴더 Topic_email과 파일명 100% 중복) 삭제 — 보호 폴더 자체는 미변경. - 완전히 비게 된 Topic_Agent/Topic_Blog/Topics_Biz/Topics_Rag 폴더 제거.
This commit is contained in:
@@ -0,0 +1,194 @@
|
||||
---
|
||||
id: wiki-2026-0508-semantic-grounding-provenance
|
||||
title: "Semantic Grounding & Provenance"
|
||||
category: 10_Wiki/Topics
|
||||
status: verified
|
||||
canonical_id: self
|
||||
aliases: [Grounding, Provenance, Citation, C2PA, Watermark]
|
||||
duplicate_of: none
|
||||
source_trust_level: A
|
||||
confidence_score: 0.88
|
||||
verification_status: applied
|
||||
tags: [grounding, provenance, citation, c2pa, watermark, rag, trust]
|
||||
raw_sources: []
|
||||
last_reinforced: 2026-05-10
|
||||
github_commit: pending
|
||||
tech_stack:
|
||||
language: python
|
||||
framework: anthropic
|
||||
---
|
||||
|
||||
# Semantic Grounding & Provenance
|
||||
|
||||
## 매 한 줄
|
||||
> **"매 claim 매 traceable to source — model output ↔ evidence ↔ origin"**. 매 LLM grounding (RAG citation, attribution) + 매 media provenance (C2PA, SynthID watermark). 매 2026 trust stack: 매 Claude/GPT-5 매 inline citations, 매 Adobe/Microsoft/OpenAI 매 C2PA Content Credentials.
|
||||
|
||||
## 매 핵심
|
||||
|
||||
### 매 Two domains
|
||||
- **LLM grounding**: 매 generated text → source documents.
|
||||
- **Media provenance**: 매 image/video/audio → creation chain (C2PA).
|
||||
|
||||
### 매 LLM grounding tactics
|
||||
- 매 RAG with citation tokens (Claude `<cite>`, GPT structured output).
|
||||
- 매 self-citation: 매 model emits `[doc_id]` markers.
|
||||
- 매 attribution training: 매 supervised on annotated traces.
|
||||
- 매 verification post-hoc: 매 entailment classifier 매 NLI score.
|
||||
|
||||
### 매 C2PA standard (2024-2026)
|
||||
- **Content Credentials**: 매 cryptographically signed manifest.
|
||||
- 매 manifest contains: 매 creator, edits, AI-generation flag, hashes.
|
||||
- 매 supported: Adobe (Photoshop/Firefly), OpenAI (DALL-E/Sora), Microsoft (Bing Image Creator), Leica/Sony cameras.
|
||||
- 매 verify: contentcredentials.org/verify.
|
||||
|
||||
### 매 Watermarking
|
||||
- **SynthID** (Google DeepMind): 매 imperceptible image+audio+text watermark.
|
||||
- **Stable Signature**: 매 model-fingerprint embedded in latent.
|
||||
- **Tree-Ring**: 매 diffusion latent watermark.
|
||||
- 매 robust to crop, compression, paraphrase (text).
|
||||
|
||||
### 매 응용
|
||||
1. News verification (Truepic, AP).
|
||||
2. RAG-based research assistants with citations.
|
||||
3. Court evidence chain-of-custody.
|
||||
4. Anti-misinfo (deepfake detection).
|
||||
|
||||
## 💻 패턴
|
||||
|
||||
### Anthropic citations API
|
||||
```python
|
||||
from anthropic import Anthropic
|
||||
client = Anthropic()
|
||||
|
||||
doc = {"type": "document", "source": {"type": "text", "media_type": "text/plain",
|
||||
"data": "The Eiffel Tower is 330m tall, completed 1889..."},
|
||||
"title": "Eiffel Tower", "citations": {"enabled": True}}
|
||||
|
||||
r = client.messages.create(
|
||||
model="claude-opus-4-7",
|
||||
max_tokens=1024,
|
||||
messages=[{"role": "user", "content": [doc, {"type": "text",
|
||||
"text": "How tall is the Eiffel Tower?"}]}],
|
||||
)
|
||||
for block in r.content:
|
||||
if block.type == "text":
|
||||
print(block.text)
|
||||
for cite in block.citations or []:
|
||||
print(f" -> {cite.cited_text} [{cite.document_title}]")
|
||||
```
|
||||
|
||||
### Inline citation prompt (model-agnostic)
|
||||
```python
|
||||
SYSTEM = """Answer using ONLY the provided documents.
|
||||
After each claim, cite as [doc_id]. If not in docs, say "not found in sources"."""
|
||||
|
||||
def grounded_answer(question, docs):
|
||||
doc_str = "\n".join(f"[{i}] {d}" for i, d in enumerate(docs))
|
||||
prompt = f"{doc_str}\n\nQuestion: {question}"
|
||||
return llm.generate(SYSTEM, prompt)
|
||||
```
|
||||
|
||||
### NLI-based attribution check
|
||||
```python
|
||||
from transformers import pipeline
|
||||
nli = pipeline("text-classification", model="microsoft/deberta-v2-xxlarge-mnli")
|
||||
|
||||
def check_attribution(claim, evidence, threshold=0.7):
|
||||
r = nli({"text": evidence, "text_pair": claim})
|
||||
entail_score = next(s["score"] for s in r if s["label"] == "ENTAILMENT")
|
||||
return entail_score >= threshold, entail_score
|
||||
```
|
||||
|
||||
### C2PA manifest read (c2pa-python)
|
||||
```python
|
||||
from c2pa import Reader
|
||||
|
||||
with open("photo.jpg", "rb") as f:
|
||||
reader = Reader.from_stream("image/jpeg", f)
|
||||
manifest = reader.json()
|
||||
print(manifest)
|
||||
# {"manifests": {"...": {"claim_generator": "Adobe Photoshop 25.0",
|
||||
# "assertions": [{"label": "c2pa.actions", "data": {"actions": [{"action": "c2pa.created"}]}},
|
||||
# {"label": "c2pa.training-mining", "data": {...}}]}}}
|
||||
```
|
||||
|
||||
### C2PA manifest write
|
||||
```python
|
||||
from c2pa import Builder, ManifestDefinition
|
||||
|
||||
manifest_def = {
|
||||
"claim_generator": "MyApp/1.0",
|
||||
"assertions": [
|
||||
{"label": "c2pa.actions", "data": {"actions": [{"action": "c2pa.created"}]}},
|
||||
{"label": "c2pa.ai_generative_training", "data": {"use": "notAllowed"}},
|
||||
],
|
||||
}
|
||||
builder = Builder(ManifestDefinition.from_json(manifest_def))
|
||||
with open("signing_cert.pem") as cert, open("signing_key.pem") as key:
|
||||
builder.sign(cert.read(), key.read(), "sha256",
|
||||
source_path="in.jpg", dest_path="out_signed.jpg")
|
||||
```
|
||||
|
||||
### SynthID-style text watermark detection
|
||||
```python
|
||||
def detect_synthid_text(text, model, key):
|
||||
# 매 conceptual: 매 measure log-prob bias on hashed-token green list
|
||||
tokens = tokenizer(text).input_ids
|
||||
score = 0.0
|
||||
for i in range(1, len(tokens)):
|
||||
green_list = hash_to_greenlist(tokens[i-1], key, vocab_size=50000)
|
||||
if tokens[i] in green_list:
|
||||
score += 1
|
||||
z = (score - 0.5 * len(tokens)) / np.sqrt(0.25 * len(tokens))
|
||||
return z > 4 # 매 z>4 → strongly watermarked
|
||||
```
|
||||
|
||||
### RAG with span-level grounding
|
||||
```python
|
||||
def span_grounded_rag(query, retriever, llm):
|
||||
chunks = retriever.search(query, k=5)
|
||||
answer = llm.generate(prompt=build_prompt(query, chunks))
|
||||
# 매 post-hoc: 매 for each sentence 매 find best supporting chunk
|
||||
grounding = []
|
||||
for sent in split_sentences(answer):
|
||||
scores = [embed_sim(sent, c) for c in chunks]
|
||||
best = int(np.argmax(scores))
|
||||
grounding.append({"sentence": sent, "source": chunks[best],
|
||||
"score": float(scores[best])})
|
||||
return answer, grounding
|
||||
```
|
||||
|
||||
## 매 결정 기준
|
||||
| 상황 | Approach |
|
||||
|---|---|
|
||||
| Research assistant | 매 Claude citations API + NLI verify |
|
||||
| News content | 매 C2PA Content Credentials |
|
||||
| AI-generated image disclosure | 매 C2PA + SynthID watermark |
|
||||
| LLM-generated text disclosure | 매 SynthID-Text 또는 disclosed metadata |
|
||||
| Court evidence | 매 C2PA + hardware-attested camera |
|
||||
|
||||
**기본값**: 매 LLM 출력 → inline citations + NLI verify; 매 media → C2PA manifest.
|
||||
|
||||
## 🔗 Graph
|
||||
- 변형: [[C2PA]]
|
||||
- Adjacent: [[Deepfake Detection]] · [[Hallucination]]
|
||||
|
||||
## 🤖 LLM 활용
|
||||
**언제**: 매 trust-critical answer (medical, legal), 매 newsroom workflow, 매 AI-content disclosure regulation (EU AI Act).
|
||||
**언제 X**: 매 casual chat (overhead), 매 creative writing (citation 매 disruptive).
|
||||
|
||||
## ❌ 안티패턴
|
||||
- **Trust without verify**: 매 model-claimed citation 매 hallucinated → 매 NLI 검증 필수.
|
||||
- **Fake C2PA**: 매 unsigned manifest 매 ignore — 매 always check signing cert chain.
|
||||
- **Watermark-only defense**: 매 strippable in many cases — 매 layer with C2PA + detection.
|
||||
- **No span granularity**: 매 doc-level citation 매 too coarse for long docs.
|
||||
|
||||
## 🧪 검증 / 중복
|
||||
- Verified (Anthropic Citations API docs, C2PA spec v2.1, Google SynthID papers 2023-2024).
|
||||
- 신뢰도 A.
|
||||
|
||||
## 🕓 Changelog
|
||||
| 날짜 | 변경 |
|
||||
|---|---|
|
||||
| 2026-05-08 | Phase 1 |
|
||||
| 2026-05-10 | Manual cleanup — RAG citation, C2PA, SynthID, NLI verification |
|
||||
Reference in New Issue
Block a user