Files
2nd/10_Wiki/Topics/Domain_Programming/AI_and_ML/Self-verification.md
T
Antigravity Agent c24165b8bc refactor(topics): 멀티 에이전트용 지식 재편 — _Common(공통 기본기) + Domain_* 구조
에이전트 8종(대화형/프로그래머 C·S/디자이너/설계자/기획자/QA/PD/PM)에게
[공통 기본 능력 + 롤별 Specialty] 2층으로 지식을 주입하기 위한 재분류.
문서 내용·포맷은 무수정, 폴더 이동만 (6,372개 문서 수 보존 확인).

- Topic_Programming → Domain_Programming (내부 구조 보존)
- Topic_Graphic → Domain_Design
- Topic_Business → Domain_Product
- Topic_General → Domain_General
- _Common 신설: Math(구 Topic_Math_Specialty), Reasoning(구 General/From_Thinking & Reasoning),
  Reasoning_Creativity(구 General/From_창의성), Communication(Poetic_Blog_Writing + From_writing)
- 타 도메인의 From_* 폴더는 유지 (출처 표기일 뿐, 이미 도메인에 맞게 분류된 문서)
- 빈 폴더 정리 (memory/procedures)
- 에이전트→폴더 매핑은 workspace의 .astra/agent-knowledge-map.json (9개 에이전트)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-11 11:05:56 +09:00

5.2 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-self-verification Self-Verification 10_Wiki/Topics verified self
Chain of Verification
CoVe
Self-Critique
LLM Self-Check
none A 0.9 applied
llm
reasoning
prompting
reliability
2026-05-10 pending
language framework
python Anthropic SDK / OpenAI SDK

Self-Verification

매 한 줄

"매 LLM 이 자기 답을 다시 점검 — generate → verify → revise". 매 Dhuliawala 2023 의 CoVe (Chain of Verification), self-consistency, self-refine, reflexion 가 매 family. 매 2026: reasoning model (Claude Opus 4.7 thinking, o3) 이 매 internalized self-verify, 그래도 매 explicit verify pass 가 critical accuracy 추가.

매 핵심

매 형태

  • Self-consistency (Wang 2022): 매 sample N 개 → majority vote.
  • Chain of Verification (CoVe): plan → baseline → verify Qs → answer Qs → final.
  • Self-refine (Madaan 2023): generate → critique → revise loop.
  • Reflexion: episodic memory of past mistakes.
  • Constitutional / RLHF self-judge: model 가 own output 평가.

매 verify 가 효과적인 곳

  • Multi-hop reasoning (factual chains).
  • Math / logic (intermediate step check).
  • Code (compile, test, lint).
  • Long-form factuality (claim-by-claim).
  • Hallucination 감소.

매 verify 가 부정확한 곳

  • Model 의 systematic bias — 같은 wrong answer.
  • Highly creative / open-ended (no ground truth).
  • 매 verify model = generator → blind spots 공유.

매 응용

  1. Agent loop critical-path step 검증.
  2. RAG answer claim verification (cite-check).
  3. Code review pre-PR.
  4. Math homework solver.
  5. Medical / legal high-stakes Q&A.

💻 패턴

Self-consistency

from collections import Counter
samples = [llm(prompt, temperature=0.8) for _ in range(7)]
answer = Counter(extract_answer(s) for s in samples).most_common(1)[0][0]

CoVe (4 steps)

baseline = llm(f"Answer: {q}")
verify_qs = llm(f"List 5 verification Qs for: {baseline}")
verify_as = [llm(f"Answer concisely: {vq}") for vq in verify_qs.splitlines()]
final = llm(f"Given verification:\n{verify_as}\nRevise: {baseline}")

Self-refine loop

draft = llm(f"Solve: {task}")
for _ in range(3):
    critique = llm(f"Critique:\n{draft}\nList concrete issues; 'NONE' if perfect.")
    if "NONE" in critique[:20]:
        break
    draft = llm(f"Revise based on critique:\n{critique}\n\nDraft:\n{draft}")

Verifier-as-different-model

draft = anthropic_call("claude-opus-4-7", task)
verdict = openai_call("gpt-5", f"Find errors in:\n{draft}")
final = anthropic_call("claude-opus-4-7", f"Address:\n{verdict}\n\nDraft:\n{draft}")

Code self-test loop

code = llm(f"Write Python for: {spec}")
for _ in range(3):
    res = run_tests(code, spec.tests)
    if res.passed:
        break
    code = llm(f"Tests failed:\n{res.report}\nFix:\n{code}")

Extended thinking (Claude 2026)

msg = anthropic.messages.create(
    model="claude-opus-4-7",
    thinking={"type": "enabled", "budget_tokens": 16000},
    messages=[{"role": "user", "content": hard_problem}],
    max_tokens=4096,
)
# 매 internal verify already happens within thinking

RAG claim-by-claim verify

claims = extract_claims(answer)
for c in claims:
    evidence = retrieve(c)
    ok = llm(f"Is '{c}' supported by:\n{evidence}\nyes/no")
    if "no" in ok.lower():
        flag(c)

매 결정 기준

상황 Approach
Cheap, parallelizable self-consistency
Factual long-form CoVe
Iterative improvement self-refine
Code / has tests execution-grounded
Reasoning model 사용 가능 thinking budget + light verify

기본값: thinking + light claim-verify (RAG case) 또는 self-consistency (3-5 samples).

🔗 Graph

🤖 LLM 활용

언제: 매 high-stakes accuracy, hallucination cost 큼. 매 budget 가 latency 보다 중요. 언제 X: 매 latency-critical (chat UI). 매 task 가 verify 가능한 ground truth 없음 (open creative).

안티패턴

  • Self-verify infinite loop: 매 max iter cap 필수.
  • Same model verify same model on bias: blind spots 공유 → cross-model verify.
  • Verify trivial output: 매 cost waste — gating 필요.
  • Trust verify verdict blindly: verify hallucinate 가능.

🧪 검증 / 중복

  • Verified (Wang 2022 Self-Consistency, Dhuliawala 2023 CoVe, Madaan 2023 Self-Refine).
  • 신뢰도 A.

🕓 Changelog

날짜 변경
2026-05-08 Phase 1
2026-05-10 Manual cleanup — verification family + thinking 2026

🛠️ 적용 사례 (Applied in summary)

🔎 코드베이스 근거 (자동 추출 — E:\Wiki 레포)

실제 구현/사용 위치:

  • connectai/src/features/selfReflector/selfReflectorPrompt.ts:67 — ## [Code Self-Verification — 코드 작성 시 추가 검증]

자동 생성: code_grounding.mjs · 재실행 시 갱신됨