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