RAG용 골든 테스트 세트 만들기
시간이 지나도 RAG 품질을 객관적으로 측정하고 비교할 수 있는 엄선된 질문-답변 데이터 세트를 만들어 보세요.
RAG용 골든 테스트 세트 만들기은(는) CoddyKit의 무료 LangChain / RAG / Vector DBs 강의입니다. 이것은 4개 중 4번째 강의입니다. 아래에서 전체 강의를 무료로 읽을 수 있으며, 내장 코드 에디터와 24/7 AI 튜터와 함께 브라우저에서 직접 실습할 수 있습니다. 이 강의는 LangChain / RAG / Vector DBs 학습 경로의 일부이며, 진행 상황이 웹과 CoddyKit 앱에 동기화됩니다. LangChain / RAG / Vector DBs 강의에는 총 4개의 강의가 포함되어 있습니다.
이 강의의 일부는 아직 번역되지 않았으며 영어로 표시됩니다.
Why You Need a Test Set
Eyeballing a few answers does not tell you if a change helped or hurt. A golden test set of question-answer pairs gives you repeatable, comparable measurements.
Anatomy of a Test Case
Each case captures what to ask, what is correct, and where the answer lives.
questionground_truthanswerrelevant_sources(expected docs)
A Sample Dataset
Store cases as simple records you can load and iterate over.
testset = [
{"question": "What is the refund window?",
"ground_truth": "30 days from purchase.",
"sources": ["policy.pdf#p2"]},
{"question": "Who approves expenses?",
"ground_truth": "The department manager.",
"sources": ["handbook.pdf#p7"]},
]Manual vs. Synthetic
You can write cases by hand for accuracy, or generate them by prompting an LLM over your documents for scale. A hybrid approach is common: generate, then review.
Generating Questions with an LLM
Feed a chunk to the model and ask it to produce a question whose answer is contained in that chunk, plus the answer itself.
prompt = (
"Read the passage and write one question a user might ask, "
"plus the exact answer.\n\nPassage: " + chunk.page_content
)
qa = llm.invoke(prompt)Reviewing Synthetic Cases
LLM-generated pairs can be ambiguous or unanswerable. Human review filters out weak cases before they pollute your metrics.
Retrieval vs. Generation Metrics
Separate two questions: did we fetch the right docs (retrieval), and did we write the right answer (generation)? Each is measured differently.
Context Recall
Context recall checks whether the expected source appears among the retrieved chunks. It isolates retrieval quality from the LLM.
def context_recall(retrieved_ids, expected_ids):
hits = sum(1 for e in expected_ids if e in retrieved_ids)
return hits / len(expected_ids)Answer Correctness
Compare the generated answer to the ground truth. Exact match is brittle, so use an LLM judge or semantic similarity for fuzzy correctness.
judge_prompt = (
"Is the ANSWER correct given the REFERENCE? Reply yes or no.\n"
"REFERENCE: " + truth + "\nANSWER: " + answer
)
verdict = llm.invoke(judge_prompt)Running the Suite
Loop over every case, run your pipeline, and aggregate scores so one number summarizes the whole system.
scores = []
for case in testset:
docs = retriever.invoke(case["question"])
ans = rag_chain.invoke(case["question"])
scores.append(evaluate(case, docs, ans))
print(sum(scores) / len(scores))Track Results Over Time
Save each run with a timestamp and the config used. When a metric drops, you can pinpoint the change that caused the regression.
Quick Check
Test your understanding of RAG evaluation.
Recap
You built an evaluation foundation:
- A golden test set of question, ground truth, and sources
- Generate then review synthetic cases
- Measure retrieval (context recall) and generation (answer correctness) separately
- Track scores across runs
자주 묻는 질문
“RAG용 골든 테스트 세트 만들기” 강의는 무료인가요?
네 — “RAG용 골든 테스트 세트 만들기” 전체 내용을 이 웹사이트에서 무료로 읽을 수 있습니다. 인터랙티브하게 실습하려면(내장 코드 에디터와 24/7 AI 튜터), CoddyKit PRO로 업그레이드하면 LangChain / RAG / Vector DBs 강의 전체를 잠금 해제할 수 있습니다. LangChain / RAG / Vector DBs 강의에는 총 4개의 강의가 포함되어 있습니다.
“RAG용 골든 테스트 세트 만들기”에서 뭘 배우나요?
시간이 지나도 RAG 품질을 객관적으로 측정하고 비교할 수 있는 엄선된 질문-답변 데이터 세트를 만들어 보세요. 브라우저에서 직접 실행하는 실습 코드로 LangChain / RAG / Vector DBs을(를) 배우며, 24/7 AI 튜터가 강의를 진행하면서 질문에 답변해줍니다.
LangChain / RAG / Vector DBs을(를) 시작하는 데 경험이 필요한가요?
사전 경험은 필요하지 않습니다. CoddyKit의 LangChain / RAG / Vector DBs은(는) 초급자부터 고급 학습자까지를 위해 구성되어 있으므로, 여기서 시작하거나 처음부터 시작할 수 있으며 자신의 속도대로 진행할 수 있습니다. 이것은 4개 중 4번째 강의입니다.
“RAG용 골든 테스트 세트 만들기” 강의는 얼마나 걸리나요?
대부분의 CoddyKit 강의는 약 5~10분이 소요됩니다. 각 강의는 간결하고 인터랙티브하여 꾸준한 진행이 가능하며, 웹과 앱에서 중단한 부분부터 바로 시작할 수 있습니다.
이 LangChain / RAG / Vector DBs 강의에서 코드를 작성하고 실행할 수 있나요?
네. 모든 LangChain / RAG / Vector DBs 강의에는 내장 코드 에디터가 포함되어 있으므로, 브라우저에서 바로 실제 코드를 작성하고 실행한 후 즉시 AI 피드백을 받을 수 있습니다 — 로컬 설정이 필요 없습니다.
이 강의의 모든 강의
- 모든 RAG 구성 요소 통합
- 쿼리 처리와 답변 생성
- RAG 시스템 성능 평가
- RAG용 골든 테스트 세트 만들기