--- id: [[P-Reinforce|P-Reinforce]]-AUTO-REF-001 category: AI_and_ML confidence_score: 1.00 tags: [auto-reinforced, rag-evaluation, ragas, faithfulness, llm-as-judge, quality-assurance] last_reinforced: 2026-05-04 --- # [[RAG Evaluation Frameworks|RAG Evaluation Frameworks]] ## πŸ“Œ ν•œ 쀄 톡찰 (The Karpathy Summary) > "RAG ν’ˆμ§ˆμ˜ 자율 검증 체계: μˆ˜μž‘μ—… ν‰κ°€μ˜ ν•œκ³„λ₯Ό λ„˜μ–΄ [[LLM-as-judge|LLM-as-judge]] 기법을 ν™œμš©ν•˜μ—¬ κ²€μƒ‰μ˜ μ •ν™•μ„±κ³Ό μƒμ„±μ˜ 진싀성을 μžλ™μœΌλ‘œ μΈ‘μ •ν•˜κ³  κ°œμ„ ν•˜λŠ” 평가 μ—”μ§€λ‹ˆμ–΄λ§ ν”„λ ˆμž„μ›Œν¬." ## πŸ“– κ΅¬μ‘°ν™”λœ 지식 (Synthesized Content) RAG 평가 ν”„λ ˆμž„μ›Œν¬λŠ” 검색 증강 생성 μ‹œμŠ€ν…œμ˜ 각 단계(검색 및 생성)λ₯Ό μ •λŸ‰μ μœΌλ‘œ ν‰κ°€ν•˜μ—¬ νŒŒμ΄ν”„λΌμΈμ„ μ΅œμ ν™”ν•˜λŠ” 데 μ‚¬μš©λ©λ‹ˆλ‹€. 1. **3λŒ€ 핡심 평가 μ§€ν‘œ (RAGAS Metric)**: * **[[Faithfulness|Faithfulness (좩싀도)]]**: μƒμ„±λœ 닡변이 κ²€μƒ‰λœ μ»¨ν…μŠ€νŠΈμ— μ–Όλ§ˆλ‚˜ κΈ°λ°˜ν•˜κ³  μžˆλŠ”κ°€? (ν™˜κ° μ–΅μ œ λŠ₯λ ₯ μΈ‘μ •) * **[[Answer Relevancy|Answer Relevancy (λ‹΅λ³€ κ΄€λ ¨μ„±)]]**: μ΅œμ’… 닡변이 μ‚¬μš©μžμ˜ 질문 μ˜λ„μ— μ–Όλ§ˆλ‚˜ 적절히 λΆ€ν•©ν•˜λŠ”κ°€? * **[[Context Precision & Recall|Context Precision & Recall (λ¬Έλ§₯ ν’ˆμ§ˆ)]]**: μ§ˆλ¬Έμ— ν•„μš”ν•œ 핡심 정보가 κ²€μƒ‰λœ λ¬Έμ„œλ“€ 속에 λˆ„λ½ 없이, 상단에 ν¬ν•¨λ˜μ–΄ μžˆλŠ”κ°€? 2. **[[LLM-as-judge|LLM-as-judge]] 방법둠**: * μ‚¬λžŒμ΄ μ•„λ‹Œ κ³ μ„±λŠ₯ LLM(예: GPT-4)이 μ •ν•΄μ§„ 평가 κΈ°μ€€(Rubrics)에 따라 λ‹΅λ³€μ˜ ν’ˆμ§ˆμ„ μ μˆ˜ν™”ν•©λ‹ˆλ‹€. * RAGAS, Galileo, Maxim AI, Braintrust λ“±μ˜ μ΅œμ‹  ν”„λ ˆμž„μ›Œν¬κ°€ 이 방식을 μ±„νƒν•˜μ—¬ 평가λ₯Ό μžλ™ν™”ν•©λ‹ˆλ‹€. 3. **운영 ν”„λ‘œμ„ΈμŠ€ (Quality Gates)**: * **Golden Datasets**: μ‹€μ œ μ‹€νŒ¨ 사둀λ₯Ό λͺ¨μ•„놓은 ν‘œμ€€ 데이터셋을 κΈ°μ€€μœΌλ‘œ μ‹œμŠ€ν…œ κ°œμ„  μ—¬λΆ€λ₯Ό νŒλ‹¨ν•©λ‹ˆλ‹€. * **CI/CD 톡합**: μƒˆλ‘œμš΄ μ•Œκ³ λ¦¬μ¦˜ 배포 μ‹œ 평가 μ μˆ˜κ°€ κΈ°μ€€μΉ˜ 미달일 경우 배포λ₯Ό μžλ™μœΌλ‘œ μ°¨λ‹¨ν•˜λŠ” ν’ˆμ§ˆ 게이트λ₯Ό μ„€μ •ν•©λ‹ˆλ‹€. ## βš–οΈ Trade-offs & Caveats * **평가 λΉ„μš©**: κ³ μ„±λŠ₯ LLM을 ν‰κ°€μžλ‘œ μ‚¬μš©ν•  경우, 수만 건의 쿼리λ₯Ό ν‰κ°€ν•˜λŠ” κ³Όμ •μ—μ„œ μƒλ‹Ήν•œ API λΉ„μš©κ³Ό μ§€μ—° μ‹œκ°„μ΄ λ°œμƒν•©λ‹ˆλ‹€. * **ν‰κ°€μž 편ν–₯**: 평가 λͺ¨λΈ μžμ²΄κ°€ κ°€μ§„ 편ν–₯μ„±μœΌλ‘œ 인해 μ‚¬λžŒμ΄ λŠλΌλŠ” μ‹€μ œ ν’ˆμ§ˆκ³Ό μžλ™ν™” 점수 κ°„μ˜ 괴리가 λ°œμƒν•  수 μžˆμœΌλ―€λ‘œ, 주기적인 인간 평가(Human Evaluation) 병행이 ν•„μˆ˜μ μž…λ‹ˆλ‹€. ## πŸ’» μ‹€μ „ κ΅¬ν˜„ μ½”λ“œ (Boilerplate) `RAGAS` 라이브러리λ₯Ό μ‚¬μš©ν•˜μ—¬ κ²€μƒ‰λœ 결과와 μƒμ„±λœ λ‹΅λ³€μ˜ ν’ˆμ§ˆμ„ ν‰κ°€ν•˜λŠ” μ˜ˆμ‹œμž…λ‹ˆλ‹€. ```python from ragas import evaluate from ragas.metrics import faithfulness, answer_relevancy, context_recall from datasets import Dataset # 1. ν‰κ°€μš© 데이터셋 μ€€λΉ„ (질문, λ‹΅λ³€, κ²€μƒ‰λœ μ»¨ν…μŠ€νŠΈ, μ •λ‹΅μ§€) data_samples = { 'question': ['Astra의 P-Reinforce ν‘œμ€€μ΄ 뭐야?'], 'answer': ['μ§€μ‹μ˜ ꡬ쑰화와 보강을 μœ„ν•œ ν‘œμ€€ ν”„λ‘œν† μ½œμž…λ‹ˆλ‹€.'], 'contexts': [['Astra ν”„λ‘œμ νŠΈλŠ” P-Reinforce v3.0 ν‘œμ€€μ„ 톡해 μœ„ν‚€λ₯Ό μžλ™ν™”ν•©λ‹ˆλ‹€.']], 'ground_truth': ['P-Reinforce v3.0은 지식 보강 및 μœ„ν‚€ ν‘œμ€€ν™”λ₯Ό μœ„ν•œ ν”„λ‘œν† μ½œμž…λ‹ˆλ‹€.'] } dataset = Dataset.from_dict(data_samples) # 2. 평가 μ‹€ν–‰ score = evaluate( dataset, metrics=[faithfulness, answer_relevancy, context_recall] ) # 3. κ²°κ³Ό λŒ€μ‹œλ³΄λ“œ 좜λ ₯ print(f"Faithfulness Score: {score['faithfulness']:.4f}") print(f"Answer Relevancy: {score['answer_relevancy']:.4f}") ``` ## πŸ”— 지식 μ—°κ²° (Graph) * **μƒμœ„ μ•„ν‚€ν…μ²˜**: [[Retrieval-Augmented Generation (RAG)|RAG]], [[Agentic RAG|Agentic RAG]] * **핡심 기술**: [[LLM-as-judge|LLM-as-judge]], [[Context Precision & Recall|Context Precision & Recall]] * **운영 도ꡬ**: [[Production Observability|Observability]], [[Golden Datasets|골든 데이터셋]] --- *Last updated: 2026-05-04*