RAG 실험 만들기(빠른 경로)
AutoAI 사용하여 검색 증강 생성(RAG) 실험을 생성합니다. 문서 모음을 업로드하고 이를 벡터로 변환하여 대규모 언어 모델의 출력을 개선하는 데 사용할 수 있습니다. 최적화된 파이프라인을 비교하여 애플리케이션에 가장 적합한 RAG 패턴을 선택하세요.
데이터 원본 준비
RAG 실험을 만들기 전에 문서 모음과 평가 데이터 자산을 준비하십시오. 문서 모음은 입력 프롬프트에 대한 답변의 맥락을 제공합니다. 평가 데이터는 RAG 패턴의 성능을 측정하는 데 사용할 수 있는 샘플 질문과 답변이 포함된 JSON 파일입니다.
데이터 수집을 준비하려면 다음 가이드라인을 따르세요:
- 문서 모음에 지원되는 형식: PDF, HTML, DOCX, MD 또는 일반 텍스트
- 평가 데이터 파일에 지원되는 형식입니다: JSON
JSON 평가 파일용 템플릿
평가 데이터 파일은 RAG 패턴의 성능을 평가하기 위한 일련의 샘플 질문과 정답을 제공합니다. JSON 파일에는 이 형식을 사용합니다:
[
{
"question": "<text>",
"correct_answer": "<text>",
"correct_answer_document_ids": [
"<file>",
"<file>"
]
},
{
"question": "<text>",
"correct_answer": "<text>",
"correct_answer_document_ids": [
"<file>",
"<file>"
]
},
{
"question": "<text>",
"correct_answer": "<text>",
"correct_answer_document_ids": [
"<file>",
"<file>"
]
}
]
예를 들어 다음은 watsonx.ai Python 라이브러리 설명서를 통해 학습된 패턴에 대한 샘플 질문과 답변입니다.
[
{
"question": "What foundation models are available in watsonx.ai?",
"correct_answer": "The following models are available in watsonx.ai: \nflan-t5-xl-3b\nFlan-t5-xxl-11b\nflan-ul2-20b\ngpt-neox-20b\ngranite-13b-chat-v2\ngranite-13b-chat-v1\ngranite-13b-instruct-v2\ngranite-13b-instruct-v1\nllama-2-13b-chat\nllama-2-70b-chat\nmpt-7b-instruct2\nmt0-xxl-13b\nstarcoder-15.5b",
"correct_answer_document_ids": [
"5B37710FE7BBD6EFB842FEB7B49B036302E18F81_0.txt"
]
},
{
"question": "What foundation models are available on Watsonx, and which of these has IBM built?",
"correct_answer": "The following foundation models are available on Watsonx:\n\n1. flan-t5-xl-3b\n2. flan-t5-xxl-11b\n3. flan-ul2-20b\n4. gpt-neox-20b\n5. granite-13b-chat-v2 (IBM built)\n6. granite-13b-chat-v1 (IBM built)\n7. granite-13b-instruct-v2 (IBM built)\n8. granite-13b-instruct-v1 (IBM built)\n9. llama-2-13b-chat\n10. llama-2-70b-chat\n11. mpt-7b-instruct2\n12. mt0-xxl-13b\n13. starcoder-15.5b\n\n The Granite family of foundation models, including granite-13b-chat-v2, granite-13b-chat-v1, and granite-13b-instruct-v2 has been build by IBM.",
"correct_answer_document_ids": [
"5B37710FE7BBD6EFB842FEB7B49B036302E18F81_0.txt",
"B2593108FA446C4B4B0EF5ADC2CD5D9585B0B63C_0.txt"
]
},
{
"question": "What is greedy decoding?",
"correct_answer": "Greedy decoding produces output that closely matches the most common language in the model's pretraining data and in your prompt text, which is desirable in less creative or fact-based use cases. A weakness of greedy decoding is that it can cause repetitive loops in the generated output.",
"correct_answer_document_ids": [
"42AE491240EF740E6A8C5CF32B817E606F554E49_1.txt"
]
},
{
"question": "When to tune a foundation model?",
"correct_answer": "Tune a foundation model when you want to do the following things:\n\nReduce the cost of inferencing at scale\nGet the model's output to use a certain style or format\nImprove the model's performance by teaching the model a specialized task\nGenerate output in a reliable form in response to zero-shot prompts\"",
"correct_answer_document_ids": [
"FBC3C5F81D060CD996489B772ABAC886F12130A3_0.txt"
]
},
{
"question": "What tuning parameters are available for IBM foundation models?",
"correct_answer": "Tuning parameter values for IBM foundation models:\nInitialization method\ninitialization text\nbatch_size\naccumulate_steps\nlearning_rate\nnum_epochs\"",
"correct_answer_document_ids": [
"51747F17F413F1F34CFD73D170DE392D874D03DD_2.txt"
]
},
{
"question": "How do I avoid generating personal information with foundation models?",
"correct_answer": "To exclude personal information, try these techniques:\n- In your prompt, instruct the model to refrain from mentioning names, contact details, or personal information.\n- In your larger application, pipeline, or solution, post-process the content that is generated by the foundation model to find and remove personal information.\"",
"correct_answer_document_ids": [
"E59B59312D1EB3B2BA78D7E78993883BB3784C2B_4.txt"
]
},
{
"question": "What is Watson OpenScale?",
"correct_answer": "Watson OpenScale is a tool that helps organizations evaluate and monitor the performance of their AI models. It tracks and measures outcomes from AI models, and helps ensure that they remain fair, explainable, and compliant no matter where the models were built or are running. Watson OpenScale also detects and helps correct the drift in accuracy when an AI model is in production.",
"correct_answer_document_ids": [
"777F72F32FD20E96C4A5F0CCA461FE9A79334E96_0.txt"
]
}
]
벡터 스토어 선택
질문 및 답변 프로세스를 위해 콘텐츠를 저장하고 검색하는 데 사용되는 데이터베이스에 벡터화된 문서를 저장할 위치를 제공해야 합니다. 사용 가능한 데이터베이스 옵션에 대한 자세한 내용은 벡터 스토어 선택하기를 참조하세요.
- 기본 인메모리 크로마 데이터베이스는 실험을 실행하기 위한 임시 벡터 저장소입니다. 이 인덱스는 실험 이후에도 지속되지 않으므로 프로덕션용으로 사용하기에는 적합하지 않습니다.
- 영구적인 벡터 저장소를 원한다면 Milvus 데이터베이스에 연결하거나 설정하십시오. RAG 패턴을 배포하려는 경우 이 옵션을 사용합니다. 자세한 내용은 watsonx.data Milvus 벡터 저장소 설정을 참조하십시오
Milvus 벡터 스토어에 연결하려면 일반 Milvus 커넥터 유형 또는 watsonx.data Milvus 커넥터입니다.
이 동영상을 통해 AutoAI RAG 실험을 만드는 방법을 알아보세요.
이 동영상은 이 설명서의 개념과 작업을 시각적으로 학습할 수 있는 방법을 제공합니다.
AutoAI RAG 실험 만들기
다음 단계에 따라 기본 구성 설정을 빠른 경로로 사용하여 사용 사례에 맞는 최적의 RAG 패턴을 검색하는 실험을 정의하고 실행하세요.
watsonx.ai 시작 페이지 또는 프로젝트의 새 자산 페이지에서 AI 솔루션 자동 빌드를 클릭합니다.
실험의 이름과 설명(선택 사항)을 입력하고, 구성 크기를 선택한 다음, 만들기 버튼을 클릭합니다. 또한 프로젝트와 관련된 watsonx.ai 런타임 서비스 인스턴스가 있어야 합니다.
팁 : 실험 구성을 할 때 오류가 발생하면, 계획에 충분한 자원이 있는지 확인하십시오. 문제가 지속되면 IBM Cloud 작업 자격 증명을 교체해 보십시오.실험 유형으로 RAG 솔루션 구축을 선택합니다.
문서 수집 및 평가 데이터를 업로드하거나 연결합니다. 문서 컬렉션을 위해 최대 20개의 문서 폴더와 파일을 선택합니다. 평가 데이터 파일은 하나의 JSON 파일이어야 합니다.
문서 컬렉션의 벡터 기반 인덱스를 저장할 위치를 선택합니다.
실험 결과를 평가하기 위한 벤치마크 데이터로 사용할 JSON 파일을 지정합니다.
실험 실행을 클릭하여 기본 설정을 사용하여 RAG 파이프라인을 생성합니다:
- 최적화된 메트릭: 답변 충실도 메트릭에 대한 RAG 패턴 생성을 최적화합니다.
- 고려할 모델: 기본값인 모든 모델 유형은 RAG 패턴을 생성하는 데 사용 가능한 모든 기초 모델을 고려합니다.
사용 사례에 맞게 실험을 사용자 지정하려는 경우 실험 설정을 구성할 수 있습니다. RAG 실험 설정 사용자 지정을 참조하세요.
결과 보기
다음 도구를 사용하여 진행 상황을 확인하고 결과를 검토하세요.
실험이 실행되면 진행률 맵을 통해 파이프라인이 어떻게 생성되고 최적화되는지 시각화할 수 있습니다. 자세한 내용을 보려면 노드 위로 마우스를 가져가세요.
실험이 완료되면 최적화된 지표에 대한 결과에 따라 순위가 매겨진 실험 파이프라인을 보여주는 리더보드를 검토합니다.
파이프라인 이름을 클릭하면 세부 정보를 검토할 수 있습니다. 샘플 질문과 답변에 대해 평가된 다양한 메트릭에 대한 파이프라인의 점수를 검토하세요.
분석이 완료되면 저장을 클릭해 RAG 패턴을 테스트하고 사용하는 데 사용할 수 있는 노트북 에셋을 자동으로 생성합니다.
결과 노트북을 검토하고 실행하여 RAG 패턴을 테스트하거나 사용하세요. 자세한 내용은 RAG 패턴 저장을 참고하세요.
다음 단계
- 구성 옵션을 편집하려면 RAG 실험 설정 사용자 지정을 참조하세요.
- 패턴을 분석하려면 AutoAI RAG 패턴 세부 정보를 참조하세요.
- RAG 패턴을 저장하고 사용하려면 RAG 패턴 저장을 참고하세요.
상위 주제: AutoAI RAG 실험 구축하기